is there any way to change the order of name resolution in linking (aside from putting the libraries in the right order?)

Vardhan, Sundara (GE Transportation) sundara.vardhan@ge.com
Fri Sep 28 13:13:00 GMT 2012


Hi Dan

I think -l defaults to .so and does not include .a if the extension is
not explicitly mentioned. However, I am not sure if anything in this
area changed in the latest gcc.

Regards

Vardhan

-----Original Message-----
From: gcc-help-owner@gcc.gnu.org [mailto:gcc-help-owner@gcc.gnu.org] On
Behalf Of Dan Hitt
Sent: Thursday, September 27, 2012 4:17 PM
To: Jonathan Wakely
Cc: gcc-help@gcc.gnu.org
Subject: Re: is there any way to change the order of name resolution in
linking (aside from putting the libraries in the right order?)

On Thu, Sep 27, 2012 at 1:08 PM, Jonathan Wakely <jwakely.gcc@gmail.com>
wrote:
> On 27 September 2012 21:04, Dan Hitt wrote:
>>
>> I was not able to use the -l abbreviation
>
> Why not?

It didn't resolve the reference.

To be really specific here (except that i have to suppress some of the
dozens of characters in the command), the command generated was:

gcc-4.6  -Wl,--whole-archive,-lX11,--no-whole-archive  [[[other stuff
deleted]]]

And that command gives the same result as just putting -lX11 first (as
opposed to putting it last, which resolves everything).

(It may be that the -l option somehow signifies *.so these days?
Because it certainly gives a much smaller executable when it works, and
i had to use the *.a forms with --whole-archive in order to make it
work?)

dan



More information about the Gcc-help mailing list