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