]> git.saurik.com Git - wxWidgets.git/blobdiff - src/common/dynload.cpp
do NOT append extension to the library names which already have it!
[wxWidgets.git] / src / common / dynload.cpp
index 2255145493c02cb4fd5b3f833375be60d33af77e..91cb64d3ebff73fbce30410f595874cd107af931 100644 (file)
 #include "wx/wxprec.h"
 
 #ifdef __BORLANDC__
-#pragma hdrstop
+    #pragma hdrstop
 #endif
 
 #if wxUSE_DYNAMIC_LOADER
 
 #ifdef __WINDOWS__
-#include "wx/msw/private.h"
+    #include "wx/msw/private.h"
 #endif
 
 #ifndef WX_PRECOMP
-#include "wx/log.h"
-#include "wx/intl.h"
+    #include "wx/log.h"
+    #include "wx/intl.h"
 #endif
 
-#include "wx/dynload.h"
+#include "wx/filename.h"        // for SplitPath()
 
+#include "wx/dynload.h"
 
 // ============================================================================
 // implementation
@@ -75,8 +76,17 @@ bool wxDynamicLibrary::Load(wxString libname, int flags)
 {
     wxASSERT_MSG(m_handle == 0, _T("Library already loaded."));
 
-    if( !(flags & wxDL_VERBATIM) )
-        libname += GetDllExt();
+    // add the proper extension for the DLL ourselves unless told not to
+    if ( !(flags & wxDL_VERBATIM) )
+    {
+        // and also check that the libname doesn't already have it
+        wxString ext;
+        wxFileName::SplitPath(libname, NULL, NULL, &ext);
+        if ( ext.empty() )
+        {
+            libname += GetDllExt();
+        }
+    }
 
 #if defined(__WXMAC__) && !defined(__UNIX__)
     FSSpec      myFSSpec;
@@ -242,7 +252,7 @@ void *wxDynamicLibrary::GetSymbol(const wxString &name, bool *success) const
         symbol = NSAddressOfSymbol( NSLookupAndBindSymbol( name.c_str() ) );
 
 #elif defined(__WINDOWS__)
-    symbol = ::GetProcAddress( m_handle, name.mb_str() );
+    symbol = (void*) ::GetProcAddress( m_handle, name.mb_str() );
 
 #else
 #error  "runtime shared lib support not implemented"