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

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

 



On Wed, Sep 26, 2012 at 10:09 PM, Dan Hitt <dan.hitt@xxxxxxxxx> wrote:
> I am building some code and i need a certain library to be linked in
> last, so it can resolve symbols left unresolved earlier.
>
> Normally the way to do this would be to just list that library last
> on the command line.
>
> However, i'm using a build system which constructs all the
> commands for me, and although it makes a provision for
> adding extra arguments to the linker, they end up going first.
>
> So although i can add arguments to the link, i cannot order
> them the way i want, and i get unresolved symbols as a consequence.
>
> So i'm wondering if there's any argument i can slip in that will change
> the order that gcc runs through the libraries in.

I'm not aware of any such option.

One thing that may work, if you are using the GNU linker or something
reasonably compatible, is
    -Wl,--whole-archive,-lMYLIB,-Wl,--no-whole-archive

That will link in the entire contents of the library, so all the
symbols defined in the library will be available.

Ian


[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux