[LCP]stdio.h reference

Mike & Penny Novack stepbystepfarm at shaysnet.com
Tue Jan 8 01:19:20 UTC 2002


Subject: [LCP]stdio.h reference


> Hello,
> A beginner's question..
> below is a small sample program.
>
> --------sample.c------------------
>
> #include <stdio.h>
>
> int main()
> {
>  printf("Hello");
> }
>
> --------sample.c------------------
> I compile above file by
> $ cc sample.c
>
> I want to know, how linker reolves the reference for stdio.h.
> I chekced /etc/fstab file and also checked LD_LIBRARY_PATH. But i
didnt get the path for stdio.h.
> Am I missing something???
>

More to the point,  Madhav, that is something that would be resolved
prior to compile time as opposed to at link time. You are confusing
different parts of the process. Include statements mean "include along
with the source code for this compile". I haven't looked for one, but
there probably is an option available to "expand" the text included.

Of course what is included may involve references to library functions
and what the compiler does with these is not generate code but instead a
call to some library routine and put the name of that routine in a table
of "things to be brought into the link by the linker". Then when the
linker runs, it will bring in these things and then fill into the call
table where it put them. But this business of generating a call (and a
table entry) for library routines isn't limited to stuff in the include
statements. The compiler is going to be doing that for some ordinary C
statements too (eg: the printf).

Mike





More information about the linuxCprogramming mailing list