dlclose(3C)dlclose(3C)NAMEdlclose() - close a shared library
[flag ... ] file ... [library]...
This routine is thread-safe.
NOTE: The dynamic loader serializes the loading and unloading of shared
libraries in multithreaded applications using a recursive pthread mutex
lock. See the for more information.
is one of a family of routines that give the user direct access to the
dynamic linking facilities (using the option on the compiler or command
line). disassociates a shared object previously opened by from the
current process. Once an object has been closed using its symbols are
no longer available to All objects loaded automatically as a result of
invoking on the referenced object (see dlopen(3C)) are also closed.
handle is the value returned by a previous invocation of
If the referenced object was successfully closed, returns If the object
could not be closed, or if handle does not refer to an open object,
returns a non-0 value. More detailed diagnostic information is avail‐
If fails, a subsequent call to returns one of the following values.
Cannot apply relocation in library.
Cannot close library due to remaining dependencies.
Out of memory.
failed on entry to or exit from
failed on exit from
failed on entry to
A successful invocation of does not guarantee that the objects associ‐
ated with handle have actually been removed from the address space of
the process. Objects loaded by one invocation of may also be loaded by
another invocation of The same object may also be opened multiple
times. An object is not removed from the address space until all ref‐
erences to that object through an explicit invocation have been closed
and all other objects implicitly referencing that object have also been
Once an object has been closed by referencing symbols contained in that
object can cause undefined behavior.
SEE ALSOdlerrno(3C), dlerror(3C), dlopen(3C), dlsym(3C).
Texts and Tutorials
(See the option)
(See manuals(5) for ordering information)