c - How to use a function from an object file -


i'm pretty sure question duplicate, can't find answer.

i wrote function (in "function.h" , "function.c" files), , compiled "function.o" file. want use function defined in "function.c" in main source, without including "function.h". possible, compile main.c using "function.o"?

a header file (usually) list of declarations inserted textually (by #include) source files.

therefore, if function.h contains

void foo(int x); 

and have #include "function.h" in main source file, equivalent writing void foo(int x); in source file.

header files useful code organization because highly inefficient (and error-prone) copy declarations hand every source file used them. but, if want avoid header file reason, copying declarations directly source file has same effect #include'ing file.


Comments

Popular posts from this blog

ios - iPhone/iPad different view orientations in different views , and apple approval process -

java Extracting Zip file -

C# WinForm - loading screen -