delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1999/01/11/15:06:37

From: fprintf AT iname DOT com (Stuart Hall)
Newsgroups: comp.os.msdos.djgpp
Subject: Newbie question - want to have one function in a separate file, how do I code?
Date: Mon, 11 Jan 1999 17:50:06 GMT
Organization: Connix - The Connecticut Internet Exchange
Lines: 30
Message-ID: <369c3855.11709658@news>
NNTP-Posting-Host: m5.aetna.com
Mime-Version: 1.0
X-Newsreader: Forte Agent 1.5/32.452
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

I can't ask this is the C groups because I am afraid that it is
compiler specific...  anyway...

I have made an implementation of gets() that is a lot safer than the
standard function - it is safer because it won't overrun an array.

I would like to include this function in just about every program that
I write, but I don't really want to write the function prototype and
copy and paste the function into every program.  Is there a method for
placing either the Object file, or the C file in a common location and
calling for it with an #include statement?

I tried compiling the two programs together by accident (I had both of
them open at once in RHIDE), where make tried creating an aout.o file,
but I got all sorts of errors about multiple #include statements (I
use the <string.h> header in both the getsafe() program and my main
program.

Is the method to simply create a file with just the function and its
prototype without any #include information?

I really need to try looking at the 'info' documentation some more,
but if anyone has any additional advice, I'd be glad to hear it.

Thanks,
Stuart
- ratboy
(don't be surprised if you email me and the response
comes back from somewhere else - iname.com is just a 
forwarding service)

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019