c header files

C header files contain only function prototypes,right! Where are those functions stored?I means functions like printf and everything else?Are they stored in the C library?In those lib files?And what are those .so and .a files that you see there in the libraries, are they the functions that have already been compiled and made into objects?
vikasgkuttyAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

TheBeaverCommented:
Basically, you have answered the last question yourself: The functions are compiled into the lib files.
The .a files are archives ie Multiple .obj files merged into one file for sanity preservation.

Note:Not all functions have source/object code! You see, C is made up of 27 standard commands (if, else, while, etc) these are interpreted by the compiler directly.
0
ssnkumarCommented:
Header file contains declarations; Library contains definitions.
stdio.h contains declaration for printf().
libc.so contains the definition of printf().

There are 2 types of library files. Static library, also called as archives and they contain .a extension. And dynamic library, also called as static object and they contain extension .so.

When you compile your C program, the compiler automatically links to few library and one of them is libc.so. For other libraries such as pthread or ncurses, you will have to link them while compiling.

The compiler first looks for static object and if it is not found, then it looks for archive.

The program compiled with archive will be huge, because the library will be compiled along with the program. The program compiled with static object will be small. They will contain, just the library name and path and the actual library file will be brought to memory during runtime. And if already some program which was using that library and hence the library file was already in memory, then the same copy will be shared by both, thus saving memory.

Hope this much info is enough:-) Tell me what else you want to know!?

-Narendra
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Programming

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.