Question about linking multiple copies of the same library

Lourens Janse van Rensburg Lourens.jansevanRensburg@intec.co.za
Fri Dec 31 08:38:00 GMT 2004


What I usually do is to make a symbolic link that has the name of the
desired (older) version of the .so, and make it point to the current
(newer) version of the .so

e.g. if I have a program that requires an older version of library x,
say libx.so.1, while I have on my system only a newer version, say
libx.so.2, I do the following:

$ll
-rw-rw-rw-    1 vanrensb users        0 Dec 31 10:24 libX.so.2

$ln -s libx.so.2 libx.so.1

$ll
-rw-rw-rw-    1 vanrensb users        0 Dec 31 10:24 libx.so.2
lrwxrwxrwx    1 vanrensb users        9 Dec 31 10:26 libx.so.1 ->
libx.so.2


This usually works because the libraries are backwards compatible, i.e.
they add new stuff in the later versions but they don't remove the
existing functions inside the library.  

* Your old program should run OK because the symlink makes it think that
it is linking to the older version of the .so.
* Your new programs should automatically link to the current (newer)
version of the .so because your compiler/linker is aware of the correct
library version that it needs.

Hope this helps.

Lourens...


-----Original Message-----
From: gcc-help-owner@gcc.gnu.org [mailto:gcc-help-owner@gcc.gnu.org] On
Behalf Of Matthias David Siebler
Sent: 30 December 2004 01:19
To: gcc-help@gcc.gnu.org
Subject: Question about linking multiple copies of the same library



Hello:

i have a question about how to link multiple copies of the same library.
I have a existing application with needs to include a thirdparty
library.  (For this library source is not
available)  This is a dynamically linked library that requires
libstdc++-libc6.1-2.so.3

My current application uses a newer compiler which requires
libstdc++-libc6.2-2.so.3

Is it possible to link the application such that the IBM library links
to the old libstdc++ and everything else resolves to the new library?

How can this be done?

Thanks



__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around
http://mail.yahoo.com 



More information about the Gcc-help mailing list