Hi! As promised in the other thread, here's a patch (on top of the thread-error-mode-2.patch) to ensure that the reported error is the error from the LoadLibrary call.
Cheers, Peter 2010-03-17 Peter Rosin <p...@lysator.liu.se> Preserve the last error when restoring the error mode. * libltdl/loaders/loadlibrary.c (wm_open): Don't rely on SetThreadErrorMode (or SetErrorMode) to not clobber the last error. Report by Ralf Wildenhues. -- They are in the crowd with the answer before the question. > Why do you dislike Jeopardy?
diff --git a/libltdl/loaders/loadlibrary.c b/libltdl/loaders/loadlibrary.c index 620e7cf..179c009 100644 --- a/libltdl/loaders/loadlibrary.c +++ b/libltdl/loaders/loadlibrary.c @@ -192,12 +192,16 @@ vm_open (lt_user_data LT__UNUSED loader_data, const char *filename, { /* Silence dialog from LoadLibrary on some failures. */ DWORD errormode = getthreaderrormode (); + DWORD last_error; + setthreaderrormode (errormode | SEM_FAILCRITICALERRORS, NULL); module = LoadLibrary (wpath); /* Restore the error mode. */ + last_error = GetLastError (); setthreaderrormode (errormode, NULL); + SetLastError (last_error); } /* libltdl expects this function to fail if it is unable