dlopen
dlopen — loads a dynamic library from a file.
dlopen (filename flags)
filenameThe name of the file to open, as a string. If no absolute path
is given, the file is searched for in the user's
LD_LIBRARY path, the
/etc/ld.so.cache list of libraries, and
the /usr/lib/ directory.
flagsMust be either RTLD_LAZY or
RTLD_NOW, optionally OR'ed with
RTLD_GLOBAL.
RTLD_LAZY causes undefined symbols to be resolved as the
dynamic library code executes.
RTLD_NOW forces undefined symbols to be resolved before
dlopen returns, otherwise
dlopen fails.
RTLD_GLOBAL makes any external symbols defined in the library
available to subsequently loaded libraries.
An integer "handle" if successful, else 0.
This function is a wrapper for the dlopen shell
command. It loads a dynamic library from the file and returns a "handle",
which is an integer uniquely associated with the file for this application.
The same handle is returned each time the same library is opened, and the dl
library counts the number of links created for each handle.
If the library exports a routine named _init, that
will be executed before dlopen returns.
Gamma>dlopen("libform.so",RTLD_LAZY|RTLD_GLOBAL);134936808Gamma>dlopen("libconsole.so",RTLD_NOW);0Gamma>dlopen("libconsole.so",RTLD_LAZY);134935848Gamma>dlopen("libconsole.so",RTLD_LAZY);134935848