5 .Nd get address of a symbol
9 .Fn dlsym "void* handle" "const char* symbol"
12 returns the address of the code or data location
13 specified by the null-terminated character string
15 Which libraries and bundles are searched depends on the
25 then only that image and any libraries it depends on are searched for
30 is called with the special
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.
39 is called with the special
42 then dyld searches for the symbol in the dylibs the calling image
43 linked against when built. It is usually used when
44 you intentionally have multiply defined symbol across images
45 and want to find the "next" definition. It searches other images
46 for the definition that the caller would be using if it did not
47 have a definition. The exact search algorithm depends on whether
48 the caller's image was linked -flat_namespace or -twolevel_namespace.
49 For flat linked images, the search starts in the load ordered list
50 of all images, in the image right after the caller's image.
51 For two-level images, the search simulates how the static linker
52 would have searched for the symbol when linking the caller's
57 is called with the special
60 then the search for the symbol starts with the image that called
62 If it is not found, the search continues as if RTLD_NEXT was used.
66 is called with the special
69 then it only searches for
71 in the main executable.
77 returns a null pointer if the symbol cannot be found, and sets an error
78 condition which may be queried with
82 The symbol name passed to
84 is the name used in C source code. For example to find the address
85 of function foo(), you would pass "foo" as the symbol name. This
86 is unlike the older dyld APIs which required a leading underscore.
87 If you looking up a C++ symbol, you need to use the mangled C++ symbol