Elf major-minor shared library

Elf major-minor shared library

Post by jpg » Thu, 01 Feb 2001 08:16:15



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

 
 
 

1. SCSI Passthrough device file name/major-minor?

Greetings.  I'm trying to access a SCSI processor-type device via the SCSI
passthrough driver.  I've got a program I wrote that does a SCSI inquiry
on my CD-ROM device, and that works fine.  However, I don't really know
where the device file for the other device would be.  The CD-ROM is
easy because it's in /dev/dsk and is shown by the 'df' command.

This is on Solaris 2.5 on the Intel x86 platform (with an NCR 810 board),
with the device I'm working on at SCSI id 4.  As I mentioned, it's a
processor-type SCSI device, not a disk or CD, etc...  It won't come up
like a disk would I'd guess.

I tried looking at the FAQ as well as trying some of the "scsiinfo" type
commands, but they don't seem to support x86 platform...  Any pointers
on finding/creating the device file would be appreciated.

Thanks,
Sean
--
"We just wanted to give the band a little more thrust than most other bands."
        - Donald Fagen's reply to why they chose the band name 'Steely Dan'

URL: <http://www.tummy.com/xvscan>  HP-UX/Linux/FreeBSD X11 scanning software.

2. Corrupted ARP-Cache after Upgrade to AIX 4.3.3

3. shared library minor versions?

4. gcc and solaris 2.7 64bits

5. shared library minor number stuff doesn't work right

6. Frontpage 98 Extensions.

7. Will strip(debug shared library) == nodebug shared library ?

8. Linux 1.2.1 Slackware 2.2 PPP failure

9. Help with building shared libraries with dependencies on other shared libraries

10. Question: Inclusion of shared libraries during linking of shared libraries

11. Shared library loading shared library.

12. Need a Shared Library Guru: beyond simple shared library question

13. When is a shared library not a shared library?