]> git.saurik.com Git - wxWidgets.git/commitdiff
add wxDL_QUIET flag; use RawGetSymbol() instead of GetSymbol() in wxDL_INIT_FUNC...
authorVadim Zeitlin <vadim@wxwidgets.org>
Sun, 6 Jan 2008 01:30:58 +0000 (01:30 +0000)
committerVadim Zeitlin <vadim@wxwidgets.org>
Sun, 6 Jan 2008 01:30:58 +0000 (01:30 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@51032 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

docs/latex/wx/dynlib.tex
include/wx/dynlib.h
src/common/dynlib.cpp
src/msw/display.cpp
src/msw/textentry.cpp
src/msw/window.cpp

index 8c15876b0cb2ab96ac8d7b334dbf02767a064f3b..967416a24cfbb3a7966aff6c3a6423423f6e6551 100644 (file)
@@ -167,6 +167,8 @@ be a combination of the following bits:
 \twocolitem{wxDL\_VERBATIM}{don't try to append the appropriate extension to
 the library name (this is done by default).}
 \twocolitem{wxDL\_DEFAULT}{default flags, same as wxDL\_NOW currently}
+\twocolitem{wxDL\_QUIET}{don't log an error message if the library couldn't be
+loaded.}
 \end{twocollist}
 
 Returns \true if the library was successfully loaded, \false otherwise.
index 6f842edb17dd3e3c146f440156a525648652ec9a..0fabb058bf43a96a198697d8c9d710eb983b6570 100644 (file)
@@ -75,6 +75,8 @@ enum wxDLFlags
     wxDL_NOSHARE    = 0x00000010,   // load new DLL, don't reuse already loaded
                                     // (only for wxPluginManager)
 
+    wxDL_QUIET      = 0x00000020,   // don't log an error if failed to load
+
     wxDL_DEFAULT    = wxDL_NOW      // default flags correspond to Win32
 };
 
@@ -112,8 +114,11 @@ enum wxPluginCategory
 // with "_t" but it doesn't define a variable but just assigns the loaded value
 // to it and also allows to pass it the prefix to be used instead of hardcoding
 // "pfn" (the prefix can be "m_" or "gs_pfn" or whatever)
+//
+// notice that this function doesn't generate error messages if the symbol
+// couldn't be loaded, the caller should generate the appropriate message
 #define wxDL_INIT_FUNC(pfx, name, dynlib) \
-    pfx ## name = (name ## _t)(dynlib).GetSymbol(#name)
+    pfx ## name = (name ## _t)(dynlib).RawGetSymbol(#name)
 
 #ifdef __WXMSW__
 
index 11808003ab3ece00c5f4b3ba5912f4cf7796c576..0334bf749ea79cfb85d5338e859c968cf7378f7f 100644 (file)
@@ -101,7 +101,7 @@ bool wxDynamicLibrary::Load(const wxString& libnameOrig, int flags)
     m_handle = RawLoad(libname, flags);
 #endif
 
-    if ( m_handle == 0 )
+    if ( m_handle == 0 && !(flags & wxDL_QUIET) )
     {
 #ifdef wxHAVE_DYNLIB_ERROR
         Error();
index e5d3247e08d5ad3c86bd2c34de6de6d7594ef54c..afa4b3ea5b5bc14f97596c424a747ee4b9541974 100644 (file)
@@ -513,9 +513,7 @@ wxDisplayFactoryWin32Base::wxDisplayFactoryWin32Base()
     {
         ms_supportsMultimon = 0;
 
-        wxDynamicLibrary dllUser32(_T("user32.dll"));
-
-        wxLogNull noLog;
+        wxDynamicLibrary dllUser32(_T("user32.dll"), wxDL_VERBATIM | wxDL_QUIET);
 
         if ( (wxDL_INIT_FUNC(gs_, MonitorFromPoint, dllUser32)) == NULL ||
              (wxDL_INIT_FUNC(gs_, MonitorFromWindow, dllUser32)) == NULL ||
@@ -588,9 +586,7 @@ wxDisplayFactoryMultimon::wxDisplayFactoryMultimon()
     // implementation
     EnumDisplayMonitors_t pfnEnumDisplayMonitors;
     {
-        wxLogNull noLog;
-
-        wxDynamicLibrary dllUser32(_T("user32.dll"));
+        wxDynamicLibrary dllUser32(_T("user32.dll"), wxDL_VERBATIM | wxDL_QUIET);
         if ( (wxDL_INIT_FUNC(pfn, EnumDisplayMonitors, dllUser32)) == NULL )
             return;
     }
@@ -735,7 +731,7 @@ bool wxDisplayImplMultimon::ChangeMode(const wxVideoMode& mode)
     static ChangeDisplaySettingsEx_t pfnChangeDisplaySettingsEx = NULL;
     if ( !pfnChangeDisplaySettingsEx )
     {
-        wxDynamicLibrary dllUser32(_T("user32.dll"));
+        wxDynamicLibrary dllUser32(_T("user32.dll"), wxDL_VERBATIM | wxDL_QUIET);
         if ( dllUser32.IsLoaded() )
         {
             wxDL_INIT_FUNC_AW(pfn, ChangeDisplaySettingsEx, dllUser32);
@@ -805,13 +801,7 @@ wxDisplayFactoryDirectDraw::wxDisplayFactoryDirectDraw()
     if ( !ms_supportsMultimon )
         return;
 
-#if wxUSE_LOG
-    // suppress the errors if ddraw.dll is not found, we're prepared to handle
-    // this
-    wxLogNull noLog;
-#endif
-
-    m_dllDDraw.Load(_T("ddraw.dll"));
+    m_dllDDraw.Load(_T("ddraw.dll"), wxDL_VERBATIM | wxDL_QUIET);
 
     if ( !m_dllDDraw.IsLoaded() )
         return;
index 346791506e2bba02c0813b201ec945e3b2524fda..b763b5de8e9051f460441b936932a61e7d2be0a7 100644 (file)
@@ -295,9 +295,7 @@ bool wxTextEntry::AutoCompleteFileNames()
     static wxDynamicLibrary s_dllShlwapi;
     if ( s_pfnSHAutoComplete == (SHAutoComplete_t)-1 )
     {
-        wxLogNull noLog;
-
-        if ( !s_dllShlwapi.Load(_T("shlwapi.dll"), wxDL_VERBATIM) )
+        if ( !s_dllShlwapi.Load(_T("shlwapi.dll"), wxDL_VERBATIM | wxDL_QUIET) )
         {
             s_pfnSHAutoComplete = NULL;
         }
index 418d1eb848515a836684e6d7f211918ae65ddb99..d035da942b43716fb36e6e720daee4403cda36d4 100644 (file)
@@ -725,9 +725,7 @@ wxWindowMSW::MSWShowWithEffect(bool show,
     static bool s_initDone = false;
     if ( !s_initDone )
     {
-        wxLogNull noLog;
-
-        wxDynamicLibrary dllUser32(_T("user32.dll"), wxDL_VERBATIM);
+        wxDynamicLibrary dllUser32(_T("user32.dll"), wxDL_VERBATIM | wxDL_QUIET);
         wxDL_INIT_FUNC(s_pfn, AnimateWindow, dllUser32);
 
         s_initDone = true;