]> git.saurik.com Git - apple/dyld.git/blame - doc/man/man3/dlclose.3
dyld-239.3.tar.gz
[apple/dyld.git] / doc / man / man3 / dlclose.3
CommitLineData
bac542e6 1.Dd Nov 6, 2006
0959b6d4
A
2.Dt DLCLOSE 3
3.Sh NAME
4.Nm dlclose
5.Nd close a dynamic library or bundle
6.Sh SYNOPSIS
7.In dlfcn.h
8.Ft int
9.Fn dlclose "void* handle"
10.Sh DESCRIPTION
11.Fn dlclose
12releases a reference to the dynamic library or bundle referenced by
13.Fa handle .
14If the reference count drops to 0, the bundle is removed from the
15address space, and
16.Fa handle
17is rendered invalid.
18Just before removing a dynamic library or bundle in this way, any
19termination routines in it are called.
20.Fa handle
21is the value returned by a previous call to dlopen.
bac542e6
A
22.Pp
23Prior to Mac OS X 10.5, only bundles could be unloaded. Starting in Mac OS X 10.5,
24dynamic libraries may also be unloaded. There are a couple of cases in which a
25dynamic library will never be unloaded: 1) the main executable links against it,
262) An API that does not supoort unloading (e.g. NSAddImage()) was used to load
27it or some other dynnamic library that depends on it, 3) the dynamic library
28is in dyld's shared cache.
0959b6d4
A
29.Sh RETURN VALUES
30If
31.Fn dlclose
32is successful, it returns a value of 0.
33Otherwise it returns -1, and sets an error string that can be
34retrived with
35.Fn dlerror .
36.Pp
37.Sh SEE ALSO
38.Xr dlopen 3
39.Xr dlsym 3
40.Xr dlerror 3
41.Xr dyld 3
0959b6d4
A
42.Xr ld 1
43.Xr cc 1