HP-UX Reference (11i v1 05/09) - 3 Library Functions A-M (vol 6)
d
dlopen(3C) dlopen(3C)
flags contains the load option, defined by logical OR of the following values:
RTLD_EXT_TEXT_ADDR
Indicates that an explicit base address for the shared library text segment
is provided.
RTLD_EXT_DATA_ADDR
Indicates that an explicit base address for the shared library private data
segment is provided.
RTLD_EXT_DATA_NO_ZERO_FILL
If this flag is set, dlopene()
does not zero fill the bss part of the data
segment. This may improve load time for libraries with large bss sections.
This flag is only valid with
RTLD_EXT_DATA_ADDR
.
The dynamic loader only accesses the address fields that are specified by the flags fields.
text_addr contains the explicit base address for the shared library’s text segment.
data_addr contains the explicit base address for the shared library’s data segment.
Both the text_addr and data_addr must be aligned at a 16-byte boundary.
The caller can invoke
dlgetfileinfo()
to obtain the information needed to allocate memory for the
load segments.
The caller of
dlopene() is responsible for allocating memory with the appropriate permission:
• READ, WRITE and EXECUTE (RWX) permission for text_addr.
• READ and WRITE (RW) permission for data_addr.
RETURN VALUE
If file cannot be found, cannot be opened for reading, is not a shared object, or if an error occurs during the
process of loading file or relocating its symbolic references, dlopen() returns NULL. More detailed diag-
nostic information is available through dlerror() or dlerrno() (64-bit only).
ERRORS
If dlopen() or dlopene() fails, a subsequent call to dlerrno() returns one of the following values:
[RTLD_ERR_OPEN] Unable to open library.
[RTLD_ERR_IO] I/O error mapping library.
[RTLD_ERR_BAD_DLL] Not a valid library.
[RTLD_ERR_BAD_ELF_VER] Unknown elf version in library.
[RTLD_ERR_LIB_OPEN] Unable to find library.
[RTLD_ERR_NO_MEMORY] Out of memory.
[RTLD_ERR_BAD_RELOC] Unknown relocation type.
[RTLD_ERR_INTERNAL_ERROR] Internal error encountered in
dld.
[RTLD_ERR_DLOPEN_BAD_FLAGS]
Invalid flags for
dlopen().
[RTLD_ERR_CANT_APPLY_RELOC]
Cannot apply relocation in library.
[RTLD_ERR_TPREL_NON_TLS_SYM]
TPREL relocation on non-TLS symbol.
[RTLD_ERR_NON_TLS_RELOC_TO_TLS_SYM]
Non-thread-specific relocation referencing TLS symbol.
[RTLD_ERR_MMAP_FAILED] mmap() failed for library.
[RTLD_ERR_DLOPEN_TLS_LIB] Cannot dlopen() library because it contains TLS data.
[RTLD_ERR_CODE_UNSAT] Unsatisfied code symbol in library.
[RTLD_ERR_DATA_UNSAT] Unsatisfied data symbol in library.
HP-UX 11i Version 1: September 2005 − 4 − Hewlett-Packard Company Section 3−−175