DLCLOSE(3) | Library Functions Manual | DLCLOSE(3) |
dlclose
— close a
dynamic library or bundle
#include
<dlfcn.h>
int
dlclose
(void*
handle);
dlclose
()
releases a reference to the dynamic library or bundle referenced by
handle. If the reference count drops to 0, the bundle
is removed from the address space, and handle is
rendered invalid. Just before removing a dynamic library or bundle in this
way, any termination routines in it are called. handle
is the value returned by a previous call to dlopen.
Note: there are a couple of cases in which a dynamic library will never be unloaded: 1) the main executable directly or indirectly links against it, 2) the dynamic library is in dyld's shared cache, 3) the dynamic library has thread-local variables, or 4) the dynamic library contains Objective-C classes.
If dlclose
() is successful, it returns a
value of 0. Otherwise it returns -1, and sets an error string that can be
retrieved with dlerror
().
November 6, 2006 |