Gamestudio Links
Zorro Links
Newest Posts
Blobsculptor tools and objects download here
by NeoDumont. 03/28/24 03:01
Issue with Multi-Core WFO Training
by aliswee. 03/24/24 20:20
Why Zorro supports up to 72 cores?
by Edgar_Herrera. 03/23/24 21:41
Zorro Trader GPT
by TipmyPip. 03/06/24 09:27
VSCode instead of SED
by 3run. 03/01/24 19:06
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
5 registered members (AndrewAMD, monk12, TipmyPip, Quad, aliswee), 1,029 guests, and 6 spiders.
Key: Admin, Global Mod, Mod
Newest Members
sakolin, rajesh7827, juergen_wue, NITRO_FOREVER, jack0roses
19043 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
.h vs .c #450394
04/13/15 18:29
04/13/15 18:29
Joined: Apr 2005
Posts: 1,988
Canadian, Eh
DLively Offline OP
Serious User
DLively  Offline OP
Serious User

Joined: Apr 2005
Posts: 1,988
Canadian, Eh
Noob Question.

Why would I want to use a header file, instead of a c file? laugh


A8 Pro 8.45.4
YouTube: Create Games For Free
Free Resources: www.CGForFree.com
Re: .h vs .c [Re: DLively] #450395
04/13/15 18:36
04/13/15 18:36
Joined: May 2009
Posts: 5,370
Caucasus
3run Offline
Senior Expert
3run  Offline
Senior Expert

Joined: May 2009
Posts: 5,370
Caucasus
As far as I know, they are used for different purposes (.c and .h).
Here, I've found this over the internet (about libraries and headers):
Originally Posted By: What's the difference between a header file and a library?
Think of both like this (Disclaimer: this is a really high-level analogy wink ..

The header is a phone number you can call, while...
...the library is the actual person you can reach there!
It's the fundamental difference between "interface" and "implementation"; the interface (header) tells you how to call some functionality (without knowing how it works), while the implementation (library) is the actual functionality.


As far as I know, header file could help you to avoid 'undeclared function' issues, if you use function which is placed under the one that calls it, f.e.:
Code:
void callFunction(){
    makeBeep();
}

void makeBeep(){
    beep();
}

You can declare that 'makeBeep()' in the header file, so the whole .c file will 'know' the list of available functions (variables etc).

I might be wrong, but this is how I see it so far.

Best regards


Looking for free stuff?? Take a look here: http://badcom.at.ua
Support me on: https://boosty.to/3rung
Re: .h vs .c [Re: 3run] #450450
04/14/15 17:59
04/14/15 17:59
Joined: Sep 2003
Posts: 9,859
F
FBL Offline
Senior Expert
FBL  Offline
Senior Expert
F

Joined: Sep 2003
Posts: 9,859
Header Files should be "headers", meaning they should not contain functionality. An exception may be made for #define macros.

Usually you place there extern declarations (not used in Lite-c) for making interfaces to other c-Files known, prototypes, enums, value defines and similar.

It also depends on what you want to do with your header file. Some people even have "external" headers which may be included by foreign c Files and "internal" headers which are included by the belonging c file only.

Content you would normally put into functions however should not be found in a header, variables normally neither (despite their extern declaration) - but since Lite-C does not support externals many users declare their variables in the header as compromise.

Re: .h vs .c [Re: FBL] #450451
04/14/15 18:06
04/14/15 18:06
Joined: Sep 2003
Posts: 9,859
F
FBL Offline
Senior Expert
FBL  Offline
Senior Expert
F

Joined: Sep 2003
Posts: 9,859
The most confusing point is, that Lite-C unlike the usual C compile/link process does not build an object file per c file and link them together. This means you also include c file like you normally only would do with a h file, which sort of kills the normally quite clear difference.

Re: .h vs .c [Re: FBL] #450562
04/17/15 15:31
04/17/15 15:31
Joined: Apr 2005
Posts: 1,988
Canadian, Eh
DLively Offline OP
Serious User
DLively  Offline OP
Serious User

Joined: Apr 2005
Posts: 1,988
Canadian, Eh
Okay,

I've had to read this thread once or twice and find a couple examples along with these to clear things up a bit further but its starting to make sense now.

Thanks for clearing this up, guys laugh


A8 Pro 8.45.4
YouTube: Create Games For Free
Free Resources: www.CGForFree.com

Gamestudio download | chip programmers | Zorro platform | shop | Data Protection Policy

oP group Germany GmbH | Birkenstr. 25-27 | 63549 Ronneburg / Germany | info (at) opgroup.de

Powered by UBB.threads™ PHP Forum Software 7.7.1