Documentation Archive Developer
ADC Home > Reference Library > Reference > Mac OS X > Mac OS X Man Pages


This document is a Mac OS X manual page. Manual pages are a command-line technology for providing documentation. You can view these manual pages locally using the man(1) command. These manual pages come from many different sources, and thus, have a variety of writing styles.

For more information about the manual page format, see the manual page for manpages(5).

DLSYM(3)                 BSD Library Functions Manual                 DLSYM(3)

     dlsym -- get address of a symbol

     #include <dlfcn.h>

     dlsym(void* handle, const char* symbol);

     dlsym() returns the address of the code or data location specified by the
     null-terminated character string symbol.  Which libraries and bundles are
     searched depends on the handle parameter.

     If dlsym() is called with a handle, returned by dlopen() then only that
     image and any libraries it depends on are searched for symbol.

     If dlsym() is called with the special handle RTLD_DEFAULT, then all mach-o macho
     o images in the process (except those loaded with dlopen(xxx,
     RTLD_LOCAL)) are searched in the order they were loaded.  This can be a
     costly search and should be avoided.

     If dlsym() is called with the special handle RTLD_NEXT, then the search
     for the symbol is limited to the images which were loaded after the one
     issuing the call to dlsym().

     The dlsym() function returns a null pointer if the symbol cannot be
     found, and sets an error condition which may be queried with dlerror().

     Unlike other dyld API's, the symbol name passed to dlsym() must NOT be
     prepended with an underscore.

     dlopen(3) dlsym(3) dlerror(3) dyld(3) NSModule(3) NSObjectFileImage(3)
     ld(1) cc(1)

                                 Sept 25, 2004