[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-core-devel
Subject: Re: how do libtool convinience libraries work ?
From: Thiago Macieira <thiago () kde ! org>
Date: 2005-04-24 18:15:50
Message-ID: 200504241515.58138.thiago () kde ! org
[Download RAW message or body]
Alexander Neundorf wrote:
>If it is linked using libtool, the contents of the static lib are
> inserted into the shared lib.
>What does libtool magically do ?
Magic trickery :-)
>I mean, in the end it must come down to some gcc/ld/ar/ranlib options I
> think.
>
>So, can anybody shed some light on me, how can I have the same effect
>manually ?
Sure.
I've just found it out too:
$ nm m1.o
00000000 T func1
$ nm m2.o
00000000 T func2
$ ar r libconv.a m1.o
ar: creating libconv.a
Wrong way:
$ gcc -shared -o libshared.so m2.o libconv.a
$ nm libshared.so | grep func.
00000478 T func2
Right way:
$ gcc -shared -o libshared.so m2.o -Wl,--whole-archive libconv.a
-Wl,--no-whole-archive
$ nm libshared.so | grep func.
0000049c T func1
00000494 T func2
So, note: don't forget the --no-whole-archive in the end, or ld will try
to include other system libraries into your library.
Hint: use -nostdlib as well.
--
Thiago Macieira - thiago (AT) macieira (DOT) info
PGP/GPG: 0x6EF45358; fingerprint:
E067 918B B660 DBD1 105C 966C 33F5 F005 6EF4 5358
4. And æfter se scieppend ingelogode, he wrát "cenn", ac eala! se
rihtendgesamnung andswarode "cenn: ne wát hú cennan 'eall'. Ástynt."
[Attachment #3 (application/pgp-signature)]
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic