The following imake macro is used to build dynamic libraries:
DynamicLibraryTarget(dlib, objs, staticLibs, dynamicLibs, dlDeps, options)
This macro includes the following arguments:
dlib: name of the resulting dynamic library (suffixed by .so).
objs: library components. A list of binary object files (suffixed by .o).
staticLibs: a list of the static libraries (.a) that can be statically linked.
dynamicLibs: a list of dependencies. This list includes the dynamic libraries that must be loaded together with the resulting library. Each library can be defined in one of two ways:
-L path -l name
On the host, the linker looks for the library path/libname.so. On the target, the runtime linker looks for lib name.so in the library search path.
path
This library path can be absolute or relative and is used on the host by the linker, and on the target by the runtime linker. A relative path containing a "/" is interpreted as relative to the current directory by the runtime linker. A path without the "/" is searched in the library search path by the runtime linker.
dlDeps: a list of dynamic libraries on which the resulting library depends. If these dynamic libraries are changed, the resulting library dlib will be rebuilt. Each library must be defined as a path on the host. Generally dlDeps duplicates the libraries described in dynamicLibs. To express the dependency without embedding a path in the executable, use the -L path -l name syntax.
options: any linker options.
The following example builds a dynamic library named libfoo.so from the binary objects files a.o and b.o. When this library is loaded dynamically, the runtime linker will also load the dynamic library libdyn.so, which must be in its search path.
DynamicLibraryTarget( libfoo.so, a.o b.o, , libdyn.so, , )
Dynamic libraries are supported with the gcc
compiler only.