dladdr(3C)dladdr(3C)NAMEdladdr() - get the symbolic information for an address
[flag]... cfile ... [library]...
This routine is thread-safe.
is one of a family of routines that give the user direct access to the
dynamic linking facilities (using the option on the compiler or command
line). allows a process to obtain information about the symbol that
most closely defines a given address. determines whether the specified
address is located within one of the load modules (executable or shared
libraries) that make up the process' address space. An address is
deemed to fall within a load module when it is between the base address
at which the load module was mapped and the highest virtual address
mapped for that load module, inclusive. If a load module fits this
criteria, its dynamic symbol table is searched to locate the nearest
symbol to the specified address. The nearest symbol is the one whose
value is equal to, or closest to but less than the specified address.
dlip is a pointer to a structure. The structure must be allocated by
the user. The structure members are set by if the specified address
falls within one of the load modules. The structure contains the fol‐
The fields of the structure contain the following:
dli_fname Pointer to the filename of the load module contain‐
ing the address. The contents of this memory loca‐
tion can change between calls to
dli_fbase Handle to the load module. This can be used as the
first argument to
dli_sname Pointer to the name of the nearest symbol to the
specified address. This symbol either has the same
address, or is the nearest symbol with a lower
address. The contents of this memory location can
change between calls to
dli_saddr Actual address of the nearest symbol. For code
symbols, it contains the address of the OPD (Offi‐
cial Plabel Descriptor) for the nearest code sym‐
dli_size (ELF process only) Size of the nearest symbol as
defined in the dynamic symbol table.
dli_bind (ELF process only) Binding attribute of the nearest
symbol as defined in the dynamic symbol table. The
values for this are those used for a symbol's bind‐
ing in the ELF symbol table (see
dli_type Type of the nearest symbol. For ELF process, this
is the same as the value for type in the dynamic
symbol table. The values for this are those used
for a symbol's type in the ELF symbol table (see
For SOM process, this can have the value or as
If the specified address does not fall within one of the load modules,
is returned; the contents of the structure are not modified. Other‐
wise, a non-zero value is returned and the fields of the structure are
If no symbol is found within the load module containing address whose
value is less than or equal to address, the dli_sname, dli_saddr, and
dli_size fields are set to the dli_bind field is set to and the
dli_type field is set to
For only a subset of externally visible symbols are typically exported:
specifically those referenced by the load modules with which the is
linked. The exact set of exported symbols for any shared library or
the can be controlled using the linker (see ld(1)).
If fails, a subsequent call to returns one of the following values:
Invalid symbol address in load module.
Cannot apply relocation in library.
Address not found in any load module.
Out of memory.
failed on entry to or exit from
failed on exit from
failed on entry to
SEE ALSOcc(1), ld(1), sh(1), exec(2), dlclose(3C), dlerrno(3C), dlerror(3C),
Texts and Tutorials
(See the option)
(See manuals(5) for ordering information)