Kenwood HP 9000 Personal Computer User Manual


 
Chapter 6 245
Shared Library Management Routines
The dlopen Shared Library Management Routines
Description
dlerror returns a null-terminated character string (with no trailing
newline character) that describes the last error that occurred during
dynamic linking processing. If no dynamic linking errors have occurred
since the last invocation of dlerror, it returns NULL. Thus, invoking
dlerror a second time, immediately following a prior invocation, results
in NULL being returned.
NOTE The messages returned by dlerror may reside in a static buffer that is
overwritten on each call to dlerror. Application code should not write to
this buffer. Programs wishing to preserve an error message should make
their own copies of that message.
Example
The following code sequence shows how to use dlerror to get diagnostic
information.
void*handle;
/* Try to load a non-existing library */
handle = dlopen(“invalid.sl”, RTLD_GLOBAL | RTLD_LAZY);
if (handle == NULL) {
printf(“%s\n”, dlerror());
}
The dlsym Routine
Gets the address of a symbol in shared library.
Syntax
void *dlsym(void *handle, const char *name);