HP-UX Reference (11i v1 05/09) - 3 Library Functions A-M (vol 6)

d
dlgetfileinfo(3C) dlgetfileinfo(3C)
if (status == 0) {
/* Make a copy of the library pathname returned by
* dlgetfileinfo().
*/
pathname = strdup(info.filename);
/* Allocate data segment */
opts.data_addr = allocate_data(info.data_size);
/* Not preallocating text segment */
opts.text_addr = 0;
/* Set dlopene() flags to indicate the data segment
* has been preallocated.
*/
opts.flags = RTLD_EXT_DATA_ADDR;
/* Call dlopene() to load the library using the path
* where dlgetfileinfo found the library and the
* preallocated memory buffer for mapping the library’s
* data segment.
*/
handle = dlopene(pathname, RTLD_LAZY, &opts);
/* Remove copy of library pathname */
free(pathname);
/* Insert code here to use library */
/* Close library */
status = dlclose(handle);
/* Insert code here to free storage allocated by
* allocate_data().
*/
}
}
RETURN VALUE
If successful, dlgetfileinfo()
returns 0, otherwise a non-0 value is returned. More detailed diagnos-
tic information is available through
dlerror() or dlerrno() .
ERRORS
If dlgetfileinfo()
fails, a subsequent call to dlerrno() returns one of the following values:
[RTLD_ERR_BAD_ELF_VER] Unknown ELF version in library.
[RTLD_ERR_LIB_OPEN] Unable to find library.
[RTLD_ERR_NO_MEMORY] Cannot allocate dynamic memory.
[RTLD_ERR_INTERNAL_ERROR]
Internal error encountered in
dlgetfileinfo().
[RTLD_ERR_CANT_APPLY_RELOC]
Failed to apply relocation while resolving call to dlget-
fileinfo()
.
[RTLD_ERR_SIGINHIBIT_FAILED]
siginhibit call failed on entry to dlgetfileinfo().
[RTLD_ERR_SIGENABLE_FAILED]
sigenable call failed on exit from dlgetfileinfo().
[RTLD_ERR_BAD_ABI1] ABI mismatch because a 64-bit program found a 32-bit shared library.
HP-UX 11i Version 1: September 2005 2 Hewlett-Packard Company Section 3161