]> git.saurik.com Git - wxWidgets.git/blobdiff - src/common/dynlib.cpp
Make mouse capture checking asserts stronger and more detailed.
[wxWidgets.git] / src / common / dynlib.cpp
index 0ebec2bd9c417e6364838ff8cfae5334f3ace25f..9683402770318b57709865f49775a3c659cafaca 100644 (file)
@@ -4,7 +4,6 @@
 // Author:      Guilhem Lavaux
 // Modified by:
 // Created:     20/07/98
-// RCS-ID:      $Id$
 // Copyright:   (c) 1998 Guilhem Lavaux
 //                  2000-2005 Vadim Zeitlin
 // Licence:     wxWindows licence
@@ -54,10 +53,6 @@ WX_DEFINE_USER_EXPORTED_OBJARRAY(wxDynamicLibraryDetailsArray)
 // wxDynamicLibrary
 // ---------------------------------------------------------------------------
 
-#if defined(__WXPM__) || defined(__EMX__)
-    const wxString wxDynamicLibrary::ms_dllext(wxT(".dll"));
-#endif
-
 // for MSW/Unix it is defined in platform-specific file
 #if !(defined(__WINDOWS__) || defined(__UNIX__)) || defined(__EMX__)
 
@@ -83,7 +78,7 @@ bool wxDynamicLibrary::Load(const wxString& libnameOrig, int flags)
         wxFileName::SplitPath(libname, NULL, NULL, &ext);
         if ( ext.empty() )
         {
-            libname += GetDllExt();
+            libname += GetDllExt(wxDL_MODULE);
         }
     }
 
@@ -166,6 +161,29 @@ void *wxDynamicLibrary::GetSymbol(const wxString& name, bool *success) const
 // informational methods
 // ----------------------------------------------------------------------------
 
+/*static*/
+wxString wxDynamicLibrary::GetDllExt(wxDynamicLibraryCategory cat)
+{
+    wxUnusedVar(cat);
+#if defined(__WINDOWS__) || defined(__WXPM__) || defined(__EMX__)
+    return ".dll";
+#elif defined(__HPUX__)
+    return ".sl";
+#elif defined(__DARWIN__)
+    switch ( cat )
+    {
+        case wxDL_LIBRARY:
+            return ".dylib";
+        case wxDL_MODULE:
+            return ".bundle";
+    }
+    wxFAIL_MSG("unreachable");
+    return wxString(); // silence gcc warning
+#else
+    return ".so";
+#endif
+}
+
 /*static*/
 wxString
 wxDynamicLibrary::CanonicalizeName(const wxString& name,
@@ -177,24 +195,18 @@ wxDynamicLibrary::CanonicalizeName(const wxString& name,
 #if defined(__UNIX__) && !defined(__EMX__)
     switch ( cat )
     {
-        default:
-            wxFAIL_MSG( wxT("unknown wxDynamicLibraryCategory value") );
-            // fall through
-
-        case wxDL_MODULE:
-            // don't do anything for modules, their names are arbitrary
-            break;
-
         case wxDL_LIBRARY:
-            // library names should start with "lib" under Unix
-            nameCanonic = wxT("lib");
+            // Library names should start with "lib" under Unix.
+            nameCanonic = "lib";
+            break;
+        case wxDL_MODULE:
+            // Module names are arbitrary and should have no prefix added.
             break;
     }
-#else // !__UNIX__
-    wxUnusedVar(cat);
-#endif // __UNIX__/!__UNIX__
+#endif
+
+    nameCanonic << name << GetDllExt(cat);
 
-    nameCanonic << name << GetDllExt();
     return nameCanonic;
 }