$ a.out

dld.so: Unable to find library 'libfile2.1' $ export SHLIB_PATH=/var/tmp

$ a.out in file1 in file2

Library Example: IPF Compatibility Mode Link

This example builds a compatibility mode library and does a compatibility mode link. The +s option is not specified at link time, so the dynamic loader does not look at any environment variables to do dynamic path searching.

#build compatibility mode dlls

#libfile1.so is a dependent of libfile2.so

ld -b file1.o -o libfile1.so +h libfile1.1

ld -b file2.o -o libfile2.so +h libfile2.1 -L. -lfile1 +compat ln -s libfile1.so libfile1.1

ld main.o +compat -L. -lfile2 -lc

#move dependent lib so dld can't find it. Even when we specify SHLIB_PATH dld won't be

#able to find the dependent because we didn't link with +s

mv libfile2.so /var/tmp

ln -s /var/tmp/libfile2.so /var/tmp/libfile2.1 a.out

dld.so: Unable to find library '1:./libfile2.1' export SHLIB_PATH=/var/tmp

a.out

dld.so: Unable to find library '1:./libfile2.1'

You can use chatr+s to enable a.out in file1 and file2:

$ chatr +s enable a.out

Library Example: Using IPF Compatibility and Standard Shared Libraries

This example mixes compatibility and standard mode shared libraries. It uses PA-32-style linking and loading for the compatibility mode libraries and IPF/PA-64-style linking and loading for standard mode libraries.

#build standard mode dlls

#libfile1.so is a dependent of libfile2

$ ld -b file1.o -o libfile1.so +h libfile1.1 $ mkdir TMP

$ ld -b +b $pwd/TMP file2.o -o libfile2.so +h libfile2.1 -L. -lfile1

# build compatibility mode dlls

# libfile3.so is a dependent of libfile4

$ ld -b file3.o -o libfile3.so +h libfile3.1

$ ld -b file4.o -o libfile4.so +b $pwd/TMP +h libfile4.1 +compat -L. -lfile3 $ ln -s libfile1.so libfile1.1

$ ln -s libfile3.so libfile3.1 $ mv libfile1.so TMP

$ mv libfile3.so TMP $ cd TMP

$ ln -s libfile1.so libfile1.1 $ ln -s libfile3.so libfile3.1

$ cd ..# link with +b so ld will use RPATH at link time to find

# libfile1.so (standard mode dll)

# the linker will not use RPATH to find libfile3.so

# (compatibility mode dll)

# Note that this is true in both a standard mode link and a

# compatibility mode link. The

# linker never uses RPATH to find any compatibility mode dlls

$ ld -b +b pwd/TMP main.o -o libfile5.so +h libfile5.1 -L. -lfile2 -lfile4 ld: Can't find dependent library "./libfile3.so"

$ ld -b +b pwd/TMP main.o -o libfile5a.so +h libfile5.1 -L. -lfile2 -lfile4 +compat ld: Can't find dependent library "./libfile3.so"

Comparing Breadth-first and Depth-first Search in IPF/PA-64 Mode

For the following libraries with dependencies:

lib1.so has dependents lib2.so, lib3.so, and lib4.so lib2.so has dependents lib2a.so and lib2b.so

Using Shared Libraries in Default Mode 133

Page 133
Image 133
HP UX Software Transition Kit (STK) manual Library Example IPF Compatibility Mode Link