delorie.com/archives/browse.cgi | search |
From: | "sephiroth AT id-base DOT com" <sephiroth AT id-base DOT com> |
Newsgroups: | comp.os.msdos.djgpp |
Subject: | Re: building header files with rhide |
Date: | Tue, 07 Dec 1999 00:24:21 +0000 |
Organization: | NTL Internet News Service |
Lines: | 66 |
Message-ID: | <384C53B5.165259C4@id-base.com> |
References: | <82gi60$pqd$1 AT wanadoo DOT fr> |
NNTP-Posting-Host: | p8-mizar-rea.tch.cableol.net |
Mime-Version: | 1.0 |
X-Trace: | nclient7-gui.server.ntli.net 944526383 23299 194.168.35.8 (7 Dec 1999 00:26:23 GMT) |
X-Complaints-To: | abuse AT net DOT ntl DOT com |
NNTP-Posting-Date: | 7 Dec 1999 00:26:23 GMT |
X-Mailer: | Mozilla 4.7 [en] (Win95; I) |
X-Accept-Language: | en,ja |
To: | djgpp AT delorie DOT com |
DJ-Gateway: | from newsgroup comp.os.msdos.djgpp |
Reply-To: | djgpp AT delorie DOT com |
"regis.dupuy" wrote: > Hi > I program in c with rhide and I'm a beginner > how should I do to build my header files (name.h) to use functions I have > made in other programs without typing them again > I would be glad if someone could give me one example > (like making myfunc.h with a clear screen function in it or another one) > or show me a tutorial > regis DOT dupuy AT wanadoo DOT fr I'm not sure if this will answer your question, but here is how I create header files: Put all the relevant functions into one file which has a .c or .cpp extension. The File should go something like the following. For our purposes, we shall call the file, myfunc.c #include "myfunc.h" short my_function( short sCalc ) { sCalc += 22; } long my_function2( long lCalc ) { lCalc += 22; } This is basically where our functions definitions are held. You then want to make a header file for myfunc.c called myfunc.h to indicate a header file. Here is the example of this: /*These 2 preprocessors are there to stop the compiler including the file more than once: */ #ifndef __MYFUNC_H__ #define __MYFUNC_H__ /*Include all the Files needed by the functions first: */ #include <stdio.h> /*Prototype the functions: */ short my_function( short sCalc ); long my_function2( long lCalc ); /*Include the myfunc.c file to show where the functions are held: */ #include "myfunc.c" #end if // __MYFUNC_H__ In my opinion, the header file should follow this order. Some people may and probably will disagree. hope this helps. -- shinyblue Current listening: ---Blue Fish - One --------------------- ---Paul Van Dyk - Another way/Avenue --- - http://members.dencity.com/blahblur -
webmaster | delorie software privacy |
Copyright © 2019 by DJ Delorie | Updated Jul 2019 |