command line order of object files and libraries

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

 



I have always (since 1982) believed that when compiling C on *nix
object files should precede libraries on the command line since
the linker processes files in the same order and only loads
library routines to which it has seen references at that point.
This belief is supported by the Single Unix spec and by
the current gcc info files (under "Link Options"),
as well as other documents that I have been able to find,
such as the Apple Developer docs for gcc.

Yesterday I tried to compile a program I encountered
on Freshmeat where the link failed because the Makefile
had the libraries before the object files. When I raised
this with the author of the program, he said that I was
only the second person in many years to encounter this
problem and that he himself uses gcc on GNU/Linux and did
not encounter it. I have heard that there are linkers
that do not work this way, but do not recall ever actually
encountering one, and am surprised to hear of this
behavior with gcc on GNU/Linux.

Have I misunderstood the expected behavior of gcc?
If not, can anyone explain why the author of the
program in question describes such different
behavior? Thanks.

Bill


[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