headers file or not to header file

For discussions about programming, programming questions/advice, and projects that don't really have anything to do with Puppy.
Post Reply
Message
Author
scsijon
Posts: 1596
Joined: Thu 24 May 2007, 03:59
Location: the australian mallee
Contact:

headers file or not to header file

#1 Post by scsijon »

I'm putting this here as I suspect i'll get a better answer.

Should every application have header files?

When is a header file unnecessary?

Is there a way to build only the header files if they but not the actual package is needed?

thanks
scsijon

Ibidem
Posts: 549
Joined: Wed 26 May 2010, 03:31
Location: State of Jefferson

Re: headers file or not to header file

#2 Post by Ibidem »

scsijon wrote:I'm putting this here as I suspect i'll get a better answer.

Should every application have header files?

When is a header file unnecessary?

Is there a way to build only the header files if they but not the actual package is needed?

thanks
scsijon
1) No applications except those supporting plugins, and libraries.
Also protocols may justify headers without libraries.
Static libs always need headers.

2) When the binary does not meet the criteria in section 1, or when the target is not intended to be used for development.
Dynamic libs may be used solely for dependencies; in this case, it makes sense to distribute just the binaries.
When cross-compiling, it's ~ "any time you aren't trying to bootstrap a new self-hosting system".

3) Not for most packages. But many provide headers that don't need any "building".

ericsond
Posts: 5
Joined: Sat 13 Apr 2013, 14:54

#3 Post by ericsond »

Perhaps I am misunderstanding your question, i am also assuming you are referring to C.

The use of header files jives with C's modular approach. If you only have one file for source code, then certainly you don't need a header file, but assuming you want to modularize your code into functions, then you would want to keep these sections apart by using different C files and different header files.

You might want to look at what 'scope' means to a source files to gain a better understanding of modular functionality.

Post Reply