man.bsd.lv manual page server

Manual Page Search Parameters

DLADDR(3) Library Functions Manual DLADDR(3)

dladdrfind the shared object containing a given address

library “libc”

#include <dlfcn.h>

int
dladdr(const void *addr, Dl_info *info);

The () 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:
The pathname of the shared object containing the address.
The base address at which the shared object is mapped into the address space of the calling process.
The name of the nearest run-time symbol with a value less than or equal to addr. When possible, the symbol name is returned as it would appear in C source code.

If no symbol with a suitable value is found, both this field and dli_saddr are set to NULL.

The value of the symbol returned in dli_sname.

The () 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.

rtld(1), dlopen(3)

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 FreeBSD-12.0