Re: GTK+ library access issue?



Hi Earnie,

On Tue, 25 Oct 2011 09:08:14 -0400 you wrote:
> However, IMNSHO, if LD can find the references in out-of-order .o object
> files it should be able to do the same with out-of-order library
> archives of object files but then I don't code LD.

Well, no, for fairly obvious reasons. LD simply doesn't "find the
references" in .o object files like it does with libraries. All .o
files passed to LD are linked in full, because that's what the user is
explicitly telling it to do (and traditionally a .o file only contained
ONE chunk of linkable object, so it's fundamentally all-or-nothing). A
library is different - it's a collection of .o chunks, and
traditionally an ordered one at that. What LD does with a library is to
examine each chunk in turn, look to see if it resolves any of the
outstanding undefined symbols, and links it in if and only if it does.

So there is never a retrospective "go back and examine the libraries to
see if we need any other bits" operation. Items are always linked in
the order they appear in the command.

This also means that it actually matters quite a lot what order you
construct your library in!

HTH,

Rob


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