|
From: | Satish S |
Subject: | Re: Order of linking libraries |
Date: | Wed, 11 Jul 2007 18:33:35 +0530 |
> Date: Thu, 5 Jul 2007 20:54:46 +0530
> From: "Satish S" < address@hidden>
>
> When i try to create an exec linking with multiple libraries, does the
> order in which i link matter, if there are dependencies across the libs?
It depends on the linker, but with most of them, the order does
matter.
> eg:
>
> TEST_EXE:
> $(LN) -o TEST_EXE -l $(LIB1) $(LIB2) $(LIB3)
The Make variable for the linker is $(LD), not $(LN).
> Are the libs picked up from right to left or are they all extracted before
> being linked?
With one-pass linkers, such as GNU ld (and the other Unix linkers),
they are scanned left to right. GNU ld can be optionally forced to
repeatedly rescan a group of libraries until all symbols are resolved
(see the -( and -) options).
[Prev in Thread] | Current Thread | [Next in Thread] |