X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/4f89dbc48e4ffdec4ea55b5444c6df87df2d642d..405d8f465740a78d2d19a2b108ac8fd65ff1a5e2:/src/common/dynload.cpp diff --git a/src/common/dynload.cpp b/src/common/dynload.cpp index 6341b6d593..91cb64d3eb 100644 --- a/src/common/dynload.cpp +++ b/src/common/dynload.cpp @@ -21,22 +21,23 @@ #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 @@ -71,12 +72,21 @@ wxDllType wxDynamicLibrary::GetProgramHandle() #endif } -bool wxDynamicLibrary::Load(wxString libname, wxDLFlags flags) +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.c_str() ); + symbol = (void*) ::GetProcAddress( m_handle, name.mb_str() ); #else #error "runtime shared lib support not implemented" @@ -278,7 +288,7 @@ void *wxDynamicLibrary::GetSymbol(const wxString &name, bool *success) const wxDLImports wxPluginLibrary::ms_classes(wxKEY_STRING); -wxPluginLibrary::wxPluginLibrary(const wxString &libname, wxDLFlags flags) +wxPluginLibrary::wxPluginLibrary(const wxString &libname, int flags) : m_linkcount(1) , m_objcount(0) { @@ -459,7 +469,7 @@ wxDLManifest wxPluginManager::ms_manifest(wxKEY_STRING); // Static accessors // ------------------------ -wxPluginLibrary *wxPluginManager::LoadLibrary(const wxString &libname, wxDLFlags flags) +wxPluginLibrary *wxPluginManager::LoadLibrary(const wxString &libname, int flags) { wxString realname(libname); @@ -522,7 +532,7 @@ wxPluginLibrary *wxPluginManager::GetObjectFromHandle(wxDllType handle) // Class implementation // ------------------------ -bool wxPluginManager::Load(const wxString &libname, wxDLFlags flags) +bool wxPluginManager::Load(const wxString &libname, int flags) { m_entry = wxPluginManager::LoadLibrary(libname, flags); return IsLoaded();