HP-UX Linker and Libraries User's Guide

* allocate_data().
*/
}
}
Multithread Usage
The dlgetfileinfo routine is thread-safe.
Return Value
If successful, dlgetfileinfo returns 0, otherwise a non-0 value is returned. More detailed
diagnostic information is available through dlerror or dlerrno.
Errors
If dlgetfileinfo fails, a subsequent call to dlerrno returns an error. For a complete listing
of those values, see the dlgetfileinfo (3C) manpage.
The dlerror Routine
The dlerror routine gets diagnostic information.
Syntax
char *dlerror(void);
Description
The dlerror routine 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 must not write to this buffer. Programs taht seek to preserve
an error message must make their own copies of that message
Using dlerror to get diagnostic information
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.so", RTLD_GLOBAL | RTLD_LAZY);
if (handle == NULL) {
printf("%s\n", dlerror());
}
The dlsym Routine
The dlsym gets the address of a symbol in shared library.
Syntax
void *dlsym(void *handle, const char *name);
The dlopen Shared Library Management Routines 157