By definition, every shared library system provides a way for executables to depend on libraries, so that symbol resolution is deferred until runtime.
An inter-library dependency is one in which a library depends on
other libraries. For example, if the libtool library `libhello'
cos(3) function, then it has an inter-library dependency
on `libm', the math library that implements
Some shared library systems provide this feature in an internally-consistent way: these systems allow chains of dependencies of potentially infinite length.
However, most shared library systems are restricted in that they only allow a single level of dependencies. In these systems, programs may depend on shared libraries, but shared libraries may not depend on other shared libraries.
In any event, libtool provides a simple mechanism for you to declare
inter-library dependencies: for every library `libname' that
your own library depends on, simply add a corresponding
-lname option to the link line when you create your
library.(5) To make an example of our
`libhello' that depends on `libm':
burger$ libtool gcc -g -O -o libhello.la foo.lo hello.lo \ -rpath /usr/local/lib -lm burger$
In order to link a program against `libhello', you need to specify the same `-l' options, in order to guarantee that all the required libraries are found. This restriction is only necessary to preserve compatibility with static library systems and simple dynamic library systems.
Some platforms, such as AIX and Windows 95, do not even allow you this flexibility. In order to build a shared library, it must be entirely self-contained (that is, have references only to symbols that are found in the `.lo' files or the specified `-l' libraries), and you need to specify the -no-undefined flag. By default, libtool builds only static libraries on these kinds of platforms.
Go to the first, previous, next, last section, table of contents.