Re: Functions are not loaded?!!

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 30 April 2011 12:56, ali hagigat wrote:
> 3.13 Options for Linking
> -llibrary
> -l library
> Thus, ‘foo.o -lz bar.o’ searches library ‘z’ after file ‘foo.o’ but before
> ‘bar.o’. If ‘bar.o’ refers to functions in ‘z’, those functions may
> not be loaded.
> -------------------------------
> What does it mean "those functions may not be loaded"?

(Do you understand what a linker does?  If not, you should read up on
that instead of trying to read the gcc manual and asking questions
about every option.)

It means that if libz contains the definition of a function 'xyz' and
bar.o contains a call to 'xyz' then the symbol may not be resolved,
because the linker searches libz before it sees the unresolved symbols
in bar.o.  When the linker processes libz it hasn't seen bar.o so it
doesn't know to load the 'xyz' function. When it processes bar.o it
sees the reference to 'xyz' but it won't load it from libz, because it
has already finished processing libz.

> Where they will be loaded?

In to the resulting executable, from the library that defines them.



[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux