]> git.ipfire.org Git - thirdparty/libtool.git/commitdiff
* libltdl/loaders/loadlibrary.c (vm_open): Set the error mode so
authorPeter Ekberg <peda@lysator.liu.se>
Thu, 28 Jul 2005 10:17:17 +0000 (10:17 +0000)
committerPeter Rosin <peda@lysator.liu.se>
Thu, 28 Jul 2005 10:17:17 +0000 (10:17 +0000)
that no dialog is popped up in case the file given to
LoadLibrary is not a dll.

ChangeLog
libltdl/loaders/loadlibrary.c

index 27837c6d24a136588982b729b5907d873df1d00f..d1fbf109ca6309477f5fa24ade28fb814824a93d 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2005-07-28  Peter Ekberg  <peda@lysator.liu.se>
+
+       * libltdl/loaders/loadlibrary.c (vm_open): Set the error mode so
+       that no dialog is popped up in case the file given to
+       LoadLibrary is not a dll.
+
 2005-07-28  Peter Ekberg  <peda@lysator.liu.se>
 
        * config/ltmain.m4sh (func_mode_link) <lib>: Make sure
index 9e60d13c756eef62090b715a31bc63f199262a29..97d14fe69288da96821b00e5eef9af4d6d59d448 100644 (file)
@@ -125,15 +125,26 @@ vm_open (lt_user_data loader_data, const char *filename)
   if (!searchname)
     return 0;
 
-#if defined(__CYGWIN__)
   {
-    char wpath[MAX_PATH];
-    cygwin_conv_to_full_win32_path(searchname, wpath);
-    module = LoadLibrary(wpath);
-  }
+    /* Silence dialog from LoadLibrary on some failures.
+       No way to get the error mode, but to set it,
+       so set it twice to preserve any previous flags. */
+    UINT errormode = SetErrorMode(SEM_FAILCRITICALERRORS);
+    SetErrorMode(errormode | SEM_FAILCRITICALERRORS);
+
+#if defined(__CYGWIN__)
+    {
+      char wpath[MAX_PATH];
+      cygwin_conv_to_full_win32_path (searchname, wpath);
+      module = LoadLibrary (wpath);
+    }
 #else
-  module = LoadLibrary (searchname);
+    module = LoadLibrary (searchname);
 #endif
+
+    /* Restore the error mode. */
+    SetErrorMode(errormode);
+  }
   FREE (searchname);
 
   /* libltdl expects this function to fail if it is unable