The dlerror subroutine includes information for dlerrorsubroutine on a POWER-based platform and on dlerror subroutine on an Itanium-based platform.
dlerror Subroutine on a POWER-based Platform
Return a pointer to information about the last dlopen, dlsym, or dlclose error.
The dlerror subroutine is used to obtain information about the last error that occurred in a dynamic loading routine (that is, dlopen , dlsym , or dlclose ). The returned value is a pointer to a null-terminated string without a final newline. Once a call is made to this function, subsequent calls without any intervening dynamic loading errors will return NULL.
Applications can avoid calling the dlerror subroutine, in many cases, by examining errno after a failed call to a dynamic loading routine. If errno is ENOEXEC, the dlerror subroutine will return additional information. In all other cases, dlerror will return the string corresponding to the value of errno.
The dlerror function may invoke loadquery to ascertain reasons for a failure. If a call is made to load or unload between calls to dlopen and dlerror, incorrect information may be returned.
A pointer to a static buffer is returned; a NULL value is returned if there has been no error since the last call to dlerror. Applications should not write to this buffer; they should make a copy of the buffer if they wish to preserve the buffer's contents.
This subroutine is part of Base Operating System (BOS) Runtime.
The load (load Subroutine) subroutine, loadbind (loadbind Subroutine) subroutine, loadquery (loadquery Subroutine)subroutine, unload subroutine, dlopen (dlopen Subroutine) subroutine, dlclose (dlclose Subroutine) subroutine, dlsym (dladdr Subroutine) subroutine.
The ld command.
The Shared Libraries and Shared Memory Overview and Subroutines Overview in AIX 5L Version 5.1 General Programming Concepts: Writing and Debugging Programs.
dlerror Subroutine on an Itanium-based Platform
Gets diagnostic information.
#include <dlfcn.h> char *dlerror(void);
The dlerror subroutine returns a null-terminated character string (with no trailing newline) that describes the last error that occurred during dynamic linking processing. If no dynamic linking errors have occurred since the last invocation of dlerror, dlerror returns NULL. Thus, invoking dlerror a second time, immediately following a prior invocation, results in NULL being returned.
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.
The dladdr (dladdr Subroutine) subroutine, dlclose (dlclose Subroutine) subroutine, dlopen (dlopen Subroutine) subroutine, and dlsym (dladdr Subroutine) subroutine.