On Tue, 29 Dec 2009, Peter Rosin wrote:
I'm just saying that it is not going to be easy to deduce if an
error is allowed to be overwritten.
Have a look at libltdl/loaders/dlopen.c:vm_open(). It basically
calls dlopen and sets the error to CANNOT_OPEN if dlopen fails.
The ways I see to dig out the underlying failure is to either call
dlerror and parse the string (Eeek!) or replicate the dlopen
internals and arrive at the same cause as dlopen did (EEEK!).
If dlerror() is available it is supposed to be ignoring the supplied
CANNOT_OPEN code and invoking dlerror() instead:
#if defined(HAVE_DLERROR)
# define DLERROR(arg) dlerror ()
#else
# define DLERROR(arg) LT__STRERROR (arg)
#endif
#define DL__SETERROR(errorcode) \
LT__SETERRORSTR (DLERROR (errorcode))