www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1999/09/28/15:27:12

From: "Damian Yerrick" <web DOT poison AT pineight DOT 8m DOT com>
Newsgroups: comp.lang.c,comp.os.msdos.djgpp
Subject: Re: Newbie Question
Date: Tue, 28 Sep 1999 11:08:27 -0500
Organization: Rose-Hulman Institute of Technology
Lines: 32
Message-ID: <7sqp95$mus$1@solomon.cs.rose-hulman.edu>
References: <37F065E4 DOT 2C3B57D5 AT virtualis DOT com>
NNTP-Posting-Host: yerricde.laptop.rose-hulman.edu
X-Trace: solomon.cs.rose-hulman.edu 938535013 23516 137.112.205.146 (28 Sep 1999 16:10:13 GMT)
X-Complaints-To: news AT cs DOT rose-hulman DOT edu
NNTP-Posting-Date: 28 Sep 1999 16:10:13 GMT
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
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

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