delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1999/09/29/05:47:34

From: "chipvick" <chipvick AT email DOT msn DOT com>
References: <37F065E4 DOT 2C3B57D5 AT virtualis DOT com> <7sqp95$mus$1 AT solomon DOT cs DOT rose-hulman DOT edu>
Subject: Re: Newbie Question
Date: Wed, 29 Sep 1999 01:10:52 -0400
Lines: 53
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 5.00.2314.1300
X-MimeOLE: Produced By Microsoft MimeOLE V5.00.2314.1300
Message-ID: <uRHcHkjC$GA.253@cpmsnbbsa05>
Newsgroups: comp.lang.c,comp.os.msdos.djgpp
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

I just had a he** of a time doing the same thing.  For some good info read
the FAQ and also the answers to my post  dated 9/27 at 10:56 pm.  The most
important thing is to make sure you know how to use your compiler!! It is
very different from one to the next,  I use Borland if  you need help just
email (as it's off topic here).  In general though,  you'll need 3 files one
header.h that has just the struct defs, function prototypes (with a
semicolon on the end) and any macros you want to put in there.  the 2nd file
will be header.c this file will #include the header.h file (in quotes " ",
not < >) you just created and it will contain all of the code for the
functions in the .h file.  Compile the header.c file.  The third file you
need is yur actual program that will create your .exe file.  in this file be
sure to #include the .h file.  Compile it and enjoy - hopefully.
Like I said a lot of it is compiler dependent  <off topic> how you set up
your project and structure the nodes that you add to it </off topic>.  Good
luck

Dave
Damian Yerrick <web DOT poison AT pineight DOT 8m DOT com> wrote in message
news:7sqp95$mus$1 AT solomon DOT cs DOT rose-hulman DOT edu...
> Alex Mendes da Costa <alexmdc AT virtualis DOT com> wrote in message
> news:37F065E4 DOT 2C3B57D5 AT virtualis DOT com...
> > Hi All.
> > I know a bit about C programming (i.e. the basics) and wrote a list of C
> > routines that I want to be able to save seperately and then use them in
> > other programs I write. I don't know how to write a header file or
> > invoke the routines with it. Please Help!!
>
> To write a header file, move all the structs, typedefs, etc. into a new
> file named foo.h instead of foo.c. Then copy the first line of each
> function (the prototype) into foo.h and place a semicolon
>
> /* in foo.c */
> void Foo(int bar)
> {
>   ritalin == easy;
>   ritalin == good;
> } /* Foo Fighters joke */
>
> /* in foo.h */
> void Foo(int bar);
>
> If you define any global variables, make them extern in your
> header file.
>
> For more info, ask comp.lang.c
> To see an example, get the DOSArena source from the link below.
>
> Damian Yerrick
> http://come.to/yerrick
>
>


- Raw text -


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