I don't understand very well the mans, FAQ's and HOWTOs about
elf shared libraries, especially the use of major and minor
numbers during shared library upgrading.
What I want :
Suppose I have created a shared library libmylib.so
containing two functions myf1() and myf2() obtained
from sources myf1src.c and myf2src.c by the commands
cc -c i-fPIC -DPIC myf1src.c myf2src.c
ld mysrc.o -shared -lc -o libmylib.so
A main program myf1f2.c using this two functions,
compiled with
cc -s -L./ -lmylib myf1f2.c -o myf1f2
works fine if the env variable LD_LIBRARY_PATH is
correctly set.
Now, suppose I have to modify the function myf2() in
libmylib.so, suppose I have no more the source of myf1()
neither the one of myf1f2, and that I want conserve the
first libmylib.so.
I have tried numerous options during ld like soname,
rpath and so on, renamed and linked the libraries, as
in the following, but nothing works, except if I setenv
LD_PRELOAD with the second library.
But the use of LD_PRELOAD has nothing to do with one
unique library and majors and minors versions and it isn't
what I have in mind.
---------------------------------------------------------
#!/bin/csh
rm -f lib*
#first
cc -c -fPIC -DPIC myf1src.c myf2src.c
ld myf1src.o myf2src.o -shared -lc -o libmylib.so.1
ln -s libmylib.so.1 libmylib.so
setenv LD_LIBRARY_PATH ./
cc -L./ -lmylib myf1f2.c -o myf1f2
./myf1f2 #works ok
#second
cc -c -fPIC -DPIC myf22src.c
ld myf22src.o -shared -soname libmylib.so.1 -o libmylib.so.2
ln -sf libmylib.so.2 libmylib.so
./myf1f2 #don't find myf1, why ?
#third
ln -sf libmylib.so.1 libmylib.so
setenv LD_PRELOAD libmylib.so.2
./myf1f2 #works ok with second myf2,
#but the libraries are independent
----------------------------------------------------------
Can somebody explains me what to do ?
Thanks in advance.
JP