From kde-core-devel Sun Apr 24 18:15:50 2005 From: Thiago Macieira Date: Sun, 24 Apr 2005 18:15:50 +0000 To: kde-core-devel Subject: Re: how do libtool convinience libraries work ? Message-Id: <200504241515.58138.thiago () kde ! org> X-MARC-Message: https://marc.info/?l=kde-core-devel&m=111436657302510 MIME-Version: 1 Content-Type: multipart/mixed; boundary="--nextPart3235853.QYKLaSbnbR" --nextPart3235853.QYKLaSbnbR Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Content-Disposition: inline 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=20 =2DWl,--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=20 to include other system libraries into your library. Hint: use -nostdlib as well. =2D-=20 Thiago Macieira - thiago (AT) macieira (DOT) info PGP/GPG: 0x6EF45358; fingerprint: E067 918B B660 DBD1 105C 966C 33F5 F005 6EF4 5358 4. And =E6fter se scieppend ingelogode, he wr=E1t "cenn", ac eala! se=20 rihtendgesamnung andswarode "cenn: ne w=E1t h=FA cennan 'eall'. =C1stynt." --nextPart3235853.QYKLaSbnbR Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.0 (GNU/Linux) iD8DBQBCa+JeM/XwBW70U1gRAhNbAJ9xw/JVVfEAsiJ5iw+Wf9mrUKTmNQCgm5iT zjYyHyyhubVkkCvQi8SKzHM= =rUZ0 -----END PGP SIGNATURE----- --nextPart3235853.QYKLaSbnbR--