dladdr(3X)
NAME
dladdr − translate address to symbolic information
SYNOPSIS
cc [ flag ... ] file ... −ldl [ library ... ]
#include <dlfcn.h>
int dladdr(void ∗ address, Dl_info ∗ dlip);
MT-LEVEL
MT-Safe
DESCRIPTION
dladdr() is one of a family of routines that give the user direct access to the dynamic linking facilities. (SEE Linker and Libraries Guide ). These routines are made available via the library loaded when the option -ldl is passed to the link-editor.
These routines are available to dynamically linked processes ONLY.
dladdr() determines if the specified address is located within one of the mapped objects that make up the current applications address space. An address is deemed to fall within a mapped object when it is between the base address, and the _end address of that object. If a mapped object fits this criteria, the symbol table made available to the run-time linker is searched to locate the nearest symbol to the specified address. The nearest symbol is one that has a value less than or equal to the required address.
The Dl_info structure must be preallocated by the user. The structure members are filled in by dladdr() based on the specified address. The Dl_info structure includes the following members:
const char ∗dli_fname;
void ∗dli_fbase;
const char ∗dli_sname;
void ∗dli_saddr;
Descriptions of these members appear below.
dli_fnameContains a pointer to the filename of the containing object.
dli_fbaseContains the base address of the containing object.
dli_snameContains a pointer to the nearest symbol name to the specified address. This symbol either has the same address, or is the nearest symbol with a lower address.
dli_saddrContains the actual address of the above symbol.
RETURN VALUES
If the specified address cannot be matched to a mapped object, a 0 is returned. Otherwise a non-zero return is made and the associated Dl_info elements are filled.
SEE ALSO
ld(1), dlclose(3X), dlerror(3X), dlopen(3X), dlsym(3X)
Linker and Libraries Guide
NOTES
The Dl_info pointer elements point to addresses within the mapped objects, these may become invalid if objects are removed prior to these elements being used (see dlclose()).
If no symbol is found to describe the specified address, both the dli_sname and dli_saddr members are set to 0.
SunOS 5.5/SPARC — Last change: 20 Aug 1993