From 722122b6789e6900aea74b444124bf4c8f827b57 Mon Sep 17 00:00:00 2001 From: Peter Ekberg Date: Wed, 3 Aug 2005 14:04:22 +0000 Subject: [PATCH] * 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. --- ChangeLog | 4 ++++ libltdl/ltdl.c | 24 ++++++++++++++++++------ 2 files changed, 22 insertions(+), 6 deletions(-) diff --git a/ChangeLog b/ChangeLog index 078e8b204..8d8b6f49e 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,9 @@ 2005-08-03 Peter Ekberg + * 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. diff --git a/libltdl/ltdl.c b/libltdl/ltdl.c index 4b99e742c..b1a0e38ae 100644 --- a/libltdl/ltdl.c +++ b/libltdl/ltdl.c @@ -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 -- 2.47.3