dlclose()

Close a shared object

Synopsis:

#include <dlfcn.h>

int dlclose( void *handle );

Arguments:

handle
A handle for a shared object, returned by dlopen().

Library:

libc

Use the -l c option to qcc to link against this library. This library is usually included automatically.

Description:

The dlclose() function disassociates a shared object opened by dlopen() from the calling process. An object's symbols are no longer available after it's been closed with dlclose(). All objects loaded as a result of the closed objects dependencies are also closed.

The handle argument is the value returned by a previous call to dlopen().


Note: The dlclose() function is available only to dynamically linked processes.

Returns:

0 for success, or a nonzero value if an error occurs.

Errors:

If an error occurs, more detailed diagnostic information is available from dlerror().

Classification:

POSIX 1003.1 XSI

Safety:
Cancellation point Yes
Interrupt handler No
Signal handler No
Thread Yes

Caveats:

An object won't be removed from the address space until all references to that object (via dlopen() or dependencies from other objects) have been closed.

Referencing a symbol in a closed object can cause undefined behavior.

See also:

dladdr(), dlerror(), dlopen(), dlsym()