]> git.ipfire.org Git - thirdparty/libtool.git/commitdiff
* libltdl/ltdl.c (sys_wll_open): Set the error mode so that no
authorPeter Ekberg <peda@lysator.liu.se>
Wed, 3 Aug 2005 14:04:22 +0000 (14:04 +0000)
committerRalf Wildenhues <Ralf.Wildenhues@gmx.de>
Wed, 3 Aug 2005 14:04:22 +0000 (14:04 +0000)
dialog is popped up in case the file given to LoadLibrary is not
a dll.

ChangeLog
libltdl/ltdl.c

index 078e8b204b27b16690627dbf15c6cb7eaec6061c..8d8b6f49ee8eb60d82358412283a529bddcf5935 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,9 @@
 2005-08-03  Peter Ekberg  <peda@lysator.liu.se>
 
+       * libltdl/ltdl.c (sys_wll_open): Set the error mode so that no
+       dialog is popped up in case the file given to LoadLibrary is not
+       a dll.
+
        * ltmain.in (link mode): Properly remove the fake symbol line
        ": @PROGRAM " from the list of exported symbols.
 
index 4b99e742caf7f2c98682f0a13e86578265cd656f..b1a0e38aeb9485c8288ed09c4319612dc119e4f3 100644 (file)
@@ -1348,15 +1348,27 @@ sys_wll_open (loader_data, filename)
   if (!searchname)
     return 0;
 
-#if __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);
+  }
+
   LT_DLFREE (searchname);
 
   /* libltdl expects this function to fail if it is unable