DLADDR(3) | MidnightBSD Library Functions Manual | DLADDR(3) |
dladdr
— find the
shared object containing a given address
Standard C Library (libc, -lc)
#include
<dlfcn.h>
int
dladdr
(const
void *addr, Dl_info
*info);
The
dladdr
()
function queries the dynamic linker for information about the shared object
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
If no symbol with a suitable value is found, both this field
and dli_saddr are set to
NULL
.
void
*dli_saddr
dli_sname
.The
dladdr
()
function is available only in dynamically linked programs.
If a mapped shared object containing addr
cannot be found, dladdr
() returns 0. In that case, a
message detailing the failure can be retrieved by calling
dlerror
().
On success, a non-zero value is returned.
The dladdr
() function first appeared in
the Solaris operating system.
This implementation is bug-compatible with the Solaris implementation. In particular, the following bugs are present:
February 5, 1998 | midnightbsd-3.1 |