help-make
[Top][All Lists]
Advanced

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

Re: Order of linking libraries


From: Eli Zaretskii
Subject: Re: Order of linking libraries
Date: Fri, 06 Jul 2007 13:13:34 +0300

> 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).




reply via email to

[Prev in Thread] Current Thread [Next in Thread]