HP-UX Linker and Libraries User's Guide
Figure 17 Example 1: Unsatisfied Symbols: Problem of Unsatisfied Symbol
$ a.out
/usr/lib/dld.so: Unresolved symbol: f2 (code) from
/users/steve/dev/lib3.so
Abort(coredump)
Example 2: Using shl_load(3X)
This example (in PA-32 and PA-64/IPF +compat mode) shows how mixing archive libraries and
shared libraries using shl_load(3X) can lead to unsatisfied symbols and cause a program to
abort.
If a library being loaded depends on a definition that does not exist in the application or any of
the dependent shared libraries, the application aborts with an unsatisfied definition at run time.
This seems obvious enough when an application is first created. However, over time, as the shared
libraries evolve, new symbol imports may be introduced that were not originally anticipated. This
problem can be avoided by ensuring that shared libraries maintain accurate dependency lists.
Suppose you have a main program, main(), and three functions, f1(), f2(), and f3() each in
a separate source file. The program main() calls f1() and uses shl_load() to call f3(). The
program main() does not call f2():
$ cc -c main.c f1.c f2.c Compile to relocatable object code
$ cc -c +z f3.c Compile to position-independent code
Figure 18 Example 2: Using shl_load(3X): Compiling
Next, suppose you put f3.o into the shared library lib3.so and f1.o and f2.o into the
archive library lib12.a:
$ ld -b -o lib3.so f3.o Create a shared library.
$ ar qvc lib12.a f1.o f2.o Create an archive library.
120 Creating and Using Libraries