help-make
[Top][All Lists]
Advanced

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

Re: Order of linking libraries


From: Satish S
Subject: Re: Order of linking libraries
Date: Wed, 11 Jul 2007 18:33:35 +0530

hi ,

I am having a sort of circular dependencies across libraries., with extern params on both the libs. I am linking with gcc and not ld. I belive gcc internally uses ld for linking. correct me if i am wrong.

the option -( <archive> -) did not work for gcc. Is there any other way for going around this?

-Satish

On 7/6/07, Eli Zaretskii < address@hidden> wrote:
> 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).



--
Those who cannot remember the past are condemned to repeat it - George Santayana
reply via email to

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