Since I am new into programming my question might be obvious.
I am building my first C static library.
In order to do so, I encounter the following dilemma :
- Gathering all my functions into one unique
.c
file (leading to one unique.o
file). - Assuming uniques
.c
and.o
files for each function.
I would be inclined to prefer the second one to better maintain the library in the future. But the first one seems interessting to me because it allow me to centralize preprocessor directives. Since many of my functions require functions calls to stdio
, stdlib
, unistd
, etc. guarding multiple inclusions from preprocessor in each of my function seems very painful.
Which solution do you think is better ?