DLADDR(3) | Library Functions Manual | DLADDR(3) |
dladdr
— find the
image containing a given address
#include
<dlfcn.h>
int
dladdr
(const
void* addr, Dl_info*
info);
The
dladdr
()
function queries dyld (the dynamic linker) for information about the image
containing the address addr. The information is
returned in the structure specified by info. The
structure contains at least the following members:
const char*
dli_fname
void*
dli_fbase
const
char* dli_sname
void*
dli_saddr
dli_sname
.The
dladdr
()
function is available only in dynamically linked programs.
If an image containing addr cannot be found,
dladdr
() returns 0. On success, a non-zero value is
returned.
If the image containing addr is found, but no nearest symbol was found, the dli_sname and dli_saddr fields are set to NULL.
The dladdr
() function first appeared in
the Solaris operating system.
Mac OS X 10.3 incorporated the dlcompat package written by Jorge Acereda <jacereda@users.sourceforge.net> and Peter O'Gorman <ogorman@users.sourceforge.net>.
In Mac OS X 10.4, dlopen was rewritten to be a native part of dyld.
This man page was borrowed from FreeBSD and modified.
This implementation is almost bug-compatible with the Solaris implementation. The following bugs are present:
September 24, 2004 | macOS 14.6 |