]> git.saurik.com Git - apple/dyld.git/blob - doc/man/man3/dlsym.3
d9afeb876aafb66990ded32988de7f3507b74c07
[apple/dyld.git] / doc / man / man3 / dlsym.3
1 .Dd Sept 25, 2004
2 .Dt DLSYM 3
3 .Sh NAME
4 .Nm dlsym
5 .Nd get address of a symbol
6 .Sh SYNOPSIS
7 .In dlfcn.h
8 .Ft void*
9 .Fn dlsym "void* handle" "const char* symbol"
10 .Sh DESCRIPTION
11 .Fn dlsym
12 returns the address of the code or data location
13 specified by the null-terminated character string
14 .Fa symbol .
15 Which libraries and bundles are searched depends on the
16 .Fa handle
17 parameter.
18 .Pp
19 If
20 .Fn dlsym
21 is called with a
22 .Fa handle ,
23 returned by
24 .Fn dlopen
25 then only that image and any libraries it depends on are searched for
26 .Fa symbol .
27 .Pp
28 If
29 .Fn dlsym
30 is called with the special
31 .Fa handle
32 .Dv RTLD_DEFAULT ,
33 then all mach-o images in the process (except those loaded with dlopen(xxx, RTLD_LOCAL))
34 are searched in the order they were loaded.
35 This can be a costly search and should be avoided.
36 .Pp
37 If
38 .Fn dlsym
39 is called with the special
40 .Fa handle
41 .Dv RTLD_NEXT ,
42 then the search for the symbol is limited to the images which were loaded
43 after the one issuing the call to
44 .Fn dlsym .
45 .Pp
46 .Sh RETURN VALUES
47 The
48 .Fn dlsym
49 function
50 returns a null pointer if the symbol cannot be found, and sets an error
51 condition which may be queried with
52 .Fn dlerror .
53 .Pp
54 .Sh NOTES
55 Unlike other dyld API's, the symbol name passed to
56 .Fn dlsym
57 must NOT be prepended with an underscore.
58 .Sh SEE ALSO
59 .Xr dlopen 3
60 .Xr dlsym 3
61 .Xr dlerror 3
62 .Xr dyld 3
63 .Xr NSModule 3
64 .Xr NSObjectFileImage 3
65 .Xr ld 1
66 .Xr cc 1