HP-UX Reference (11i v2 07/12) - 3 Library Functions A-M (vol 6)

d
dlopen_pa(3C)
PA-RISC Systems Only
dlopen_pa(3C)
/* Get file info */
status = dlgetfileinfo("libfoo.so", sizeof(info), &info);
opts.flags = RTLD_EXT_DATA_ADDR;
/* allocate memory for the data segment */
opts.data_addr = (char*) mmap(0, info.data_size,
PROT_READ|PROT_WRITE,
MAP_SHARED|MAP_ANONYMOUS,
-1, 0);
/* call dlopene */
handle = dlopene("libfoo.so", RTLD_NOW|RTLD_GLOBAL, &opts);
/* Insert user code to use library */
/* close library */
status = dlclose(handle);
/* free memory */
munmap(opts.data_addr, info.data_size);
}
WARNINGS
In 64-bit mode, the environment variables LD_LIBRARY_PATH
and SHLIB_PATH should contain a
colon-separated list of directories, in the same format as the
PATH variable (see sh(1)).
LD_LIBRARY_PATH and
SHLIB_PATH are ignored if the process’s real user ID is different from its
effective user ID or its real group ID is different from its effective group ID (see exec(2)).
In 64-bit mode, with the
+compat option specified, LD_LIBRARY_PATH
and +b embedded path are
ignored while searching for dependent libraries.
Use caution when building shared libraries with external library dependencies. Any library that contains
Thread Local Storage (TLS) should not be used as a dependency. If a dependent library contains TLS, and
it is not loaded during program startup (that is, not linked against the executable), the dynamic loader fails
to perform the operation.
SEE ALSO
cc(1), ld(1), sh(1), exec(2), dlclose(3C), dlerrno(3C), dlerror(3C), dlsym(3C), dlgetfileinfo(3C),
dlsetlibpath(3C).
Texts and Tutorial s
HP-UX Linker and Libraries Online User Guide
(See the
+help option)
HP-UX Linker and Libraries User’s Guide
324 Hewlett-Packard Company 6 HP-UX 11i Version 2: December 2007 Update