DOC HOME SITE MAP MAN PAGES GNU INFO SEARCH PRINT BOOK
 

dlclose(S-osr5)


dlclose -- close a dynamically linked library

Syntax

cc . . . -lc

#include <dlfcn.h>

int dlclose(void *handle);

Description

dlclose(S-osr5) disassociates a shared object (a dynamically linked library in our case) previously opened by dlopen(S-osr5) from the current process. Once an object has been closed using dlclose( ), its symbols are no longer available to dlsym(S-osr5). All objects loaded automatically as a result of invoking dlopen( ) on the referenced object are also closed. handle is the value returned by a previous invocation of dlopen( ).

Return values

If the referenced object was successfully closed, dlclose( ) returns 0. If the object could not be closed, or if handle does not refer to an open object, dlclose( ) returns a non-zero value. More detailed diagnostic information is available through dlerror(S-osr5).

Notes

A successful invocation of dlclose( ) does not guarantee that the objects associated with handle have actually been removed from the address space of the process. Objects loaded by one invocation of dlopen( ) may also be loaded by another invocation of dlopen( ). The same object may also be opened multiple times. An object is not removed from the address space until all references to that object through an explicit dlopen( ) invocation have been closed and all other objects implicitly referencing that object have also been closed.

Once an object has been closed by dlclose( ), referencing symbols contained in that object can cause undefined behavior.

See also

dlerror(S-osr5), dlopen(S-osr5), dlsym(S-osr5)

Standards conformance

dlclose(S-osr5) is not part of any currently supported standard; it is an extension of AT&T System V provided by The Santa Cruz Operation, Inc.
© 2005 The SCO Group, Inc. All rights reserved.
SCO OpenServer Release 6.0.0 -- 02 June 2005