dynamic shared object version numbers

dynamic shared object version numbers

Post by Bruce Albrech » Fri, 02 Aug 1996 04:00:00



When I link a binary with DSO's from /usr/lib, ldd indicates that the binary
is dependent on a DSO with a version number, for example libnsl.so.1 instead of
libnsl.so, even though I just specify the library with -lnsl.  In /usr/lib,
libnsl.so is a symbolic link to libnsl.so.1.  When I try to do the same with
a DSO I create, it creates a dependency for the library (e.g., -lt gives a
dependency of libt.so) without a version number, even though my library is
symbolically linked to a DSO with a version number (libt.so.1).  How do I
create my DSO so that it has a version number like the system DSO's do?

 
 
 

dynamic shared object version numbers

Post by Bryan O'Sulliva » Fri, 02 Aug 1996 04:00:00


b> How do I create my DSO so that it has a version number like the
b> system DSO's do?

You need to specify the name of the shared object when you're linking
it.  Use the -h flag to the compiler to do this.

  cc -G -h libfoo.so.1 -o libfoo.so.1 bar.o baz.o

        <b

 
 
 

dynamic shared object version numbers

Post by Philip Guenth » Fri, 02 Aug 1996 04:00:00



Quote:> When I link a binary with DSO's from /usr/lib, ldd indicates that the binary
> is dependent on a DSO with a version number, for example libnsl.so.1 instead of
> libnsl.so, even though I just specify the library with -lnsl.  In /usr/lib,
> libnsl.so is a symbolic link to libnsl.so.1.  When I try to do the same with
> a DSO I create, it creates a dependency for the library (e.g., -lt gives a
> dependency of libt.so) without a version number, even though my library is
> symbolically linked to a DSO with a version number (libt.so.1).  How do I
> create my DSO so that it has a version number like the system DSO's do?

Check out the -h option for ld, as documented on the ld manpage.  Note
that the compilation driver (cc or gcc) probably has a special option for
creating shared libraries.  For example, with gcc you should use the
"-shared" flag, which performs some internal magic such the command:

        gcc -shared -o libfoo.so.1 foo.o

Will result in ld being invoked with, among others, the following options:

        -G -dy -z text -h libfoo.so.1 -o libfoo.so.1 -Qy

I usually add "-z defs", except when this is going to be a dlopen'ed
object, as opposed to an object that's linked in at compile time, as the
latter has the symbols in the program itself to work with, which ld cannot
take into account when doing "-z defs".

Philip Guenther

----------------------------------------------------------------
Philip Guenther                 UNIX Systems and Network Administrator

Gustavus Adolphus College       St. Peter, MN 56082-1498

 
 
 

1. creating new shared object from existing shared objects ??

Hi all.

I have two existing shared objects (and no source code and .o for them)..
Can I create my new .so/.sl using the two already existing shared objects..

Thanks
Sandeep

--
What you do today is getting you closer
to what you want to be tommorow !

http://www.atrenta.com  // Streamlining Electronic Design

2. (no subject)

3. Support for "Dynamic shared Objects" in LINUX

4. UNIX Sendmail - WIN2k Outlook interoperability

5. Shared objects dynamic link

6. Adjust monitor colors

7. Problem with new and delete in shared object (dynamic link library) files.

8. Unable to resotre dump tape.

9. Dynamic linking of C++ shared objects

10. dynamic linked shared object, library dependencies

11. Dynamic Shared Objects error

12. Shared Library/Object dynamic loading: Portability.

13. Shared object, dynamic class + polymorphism