]> git.saurik.com Git - apple/dyld.git/blob - doc/man/man3/dlclose.3
dyld-732.8.tar.gz
[apple/dyld.git] / doc / man / man3 / dlclose.3
1 .Dd Nov 6, 2006
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
12 releases a reference to the dynamic library or bundle referenced by
13 .Fa handle .
14 If the reference count drops to 0, the bundle is removed from the
15 address space, and
16 .Fa handle
17 is rendered invalid.
18 Just before removing a dynamic library or bundle in this way, any
19 termination routines in it are called.
20 .Fa handle
21 is the value returned by a previous call to dlopen.
22 .Pp
23 Prior to Mac OS X 10.5, only bundles could be unloaded. Starting in Mac OS X 10.5,
24 dynamic libraries may also be unloaded. There are a couple of cases in which a
25 dynamic library will never be unloaded: 1) the main executable links against it,
26 2) an API that does not support unloading (e.g. NSAddImage()) was used to load
27 it or some other dynamic library that depends on it, 3) the dynamic library
28 is in dyld's shared cache.
29 .Sh RETURN VALUES
30 If
31 .Fn dlclose
32 is successful, it returns a value of 0.
33 Otherwise it returns -1, and sets an error string that can be
34 retrieved 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
42 .Xr ld 1
43 .Xr cc 1