HP-UX Linker and Libraries User's Guide

Figure 19 Example 2: Using shl_load(3X): Mixing Shared and Archive Libraries
Now link the main with the archive library, and create the executable a.out:
$ cc main.o lib12.a -ldld Link the program.
Figure 20 Example 2: Using shl_load(3X): Creating the Executable
When you run a.out, it runs correctly. Now suppose you need to modify f3() to call f2():
Figure 21 Example 2: Using shl_load(3X): Modifying a Function
Problem
Here is where a problem can be introduced. If you compile the new f3() and rebuild the shared
library lib3.so >without specifying the dependency on a shared library containing f2(), calls
to f3() aborts.
$ cc -c +z f3.c Compile to position-independent code.
$ ld -b -o lib3.so f3.o Error! Missing library containing f2().
Caution When Mixing Shared and Archive Libraries 121