|
|
HP-UX Reference > Ddladdr(3C)HP-UX 11i Version 2: December 2007 Update |
|
NAMEdladdr() — get the symbolic information for an address DESCRIPTIONdladdr() is one of a family of routines that give the user direct access to the dynamic linking facilities (using the -ldl option on the compiler or ld command line). dladdr() allows a process to obtain information about the symbol that most closely defines a given address. dladdr() 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 Dl_info structure. The structure must be allocated by the user. The structure members are set by dladdr() if the specified address falls within one of the load modules. The Dl_info structure contains the following members: struct { const char *dli_fname; void *dli_fbase; const char *dli_sname; void *dli_saddr; size_t dli_size; /* ELF only */ int dli_bind; /* ELF only */ int dli_type; }; The fields of the Dl_info structure contain the following:
RETURN VALUEIf the specified address does not fall within one of the load modules, 0 is returned; the contents of the Dl_info structure are not modified. Otherwise, a non-zero value is returned and the fields of the Dl_info structure are set. DIAGNOSTICSIf 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 0; the dli_bind field is set to STB_LOCAL, and the dli_type field is set to STT_NOTYPE. For a.out's, only a subset of externally visible symbols are typically exported: specifically those referenced by the load modules with which the a.out is linked. The exact set of exported symbols for any shared library or the a.out can be controlled using the linker (see ld(1)). ERRORSIf dladdr() fails, a subsequent call to dlerrno() returns one of the following values:
SEE ALSOcc(1), ld(1), sh(1), exec(2), dlclose(3C), dlerrno(3C), dlerror(3C), dlsym(3C). Texts and Tutorials
|
|