Use correct extensions in wxDynamicLibrary::CanonicalizeName() on OS X.
Contrary to the documentation, this function incorrectly appended the .bundle extension on OS X for libraries as well as modules. Fixed to use .dylib for libraries (wxDL_LIBRARY) and continue to use .bundle for loadable modules (wxDL_MODULE). Change GetDllExt() to take optional wxDynamicLibearyCategory argument. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@74161 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -232,7 +232,7 @@ public:
|
|||||||
static wxDllType GetProgramHandle();
|
static wxDllType GetProgramHandle();
|
||||||
|
|
||||||
// return the platform standard DLL extension (with leading dot)
|
// return the platform standard DLL extension (with leading dot)
|
||||||
static const wxString& GetDllExt() { return ms_dllext; }
|
static wxString GetDllExt(wxDynamicLibraryCategory cat = wxDL_LIBRARY);
|
||||||
|
|
||||||
wxDynamicLibrary() : m_handle(0) { }
|
wxDynamicLibrary() : m_handle(0) { }
|
||||||
wxDynamicLibrary(const wxString& libname, int flags = wxDL_DEFAULT)
|
wxDynamicLibrary(const wxString& libname, int flags = wxDL_DEFAULT)
|
||||||
@@ -372,9 +372,6 @@ protected:
|
|||||||
#endif // wxHAVE_DYNLIB_ERROR
|
#endif // wxHAVE_DYNLIB_ERROR
|
||||||
|
|
||||||
|
|
||||||
// platform specific shared lib suffix.
|
|
||||||
static const wxString ms_dllext;
|
|
||||||
|
|
||||||
// the handle to DLL or NULL
|
// the handle to DLL or NULL
|
||||||
wxDllType m_handle;
|
wxDllType m_handle;
|
||||||
|
|
||||||
|
@@ -54,10 +54,6 @@ WX_DEFINE_USER_EXPORTED_OBJARRAY(wxDynamicLibraryDetailsArray)
|
|||||||
// wxDynamicLibrary
|
// wxDynamicLibrary
|
||||||
// ---------------------------------------------------------------------------
|
// ---------------------------------------------------------------------------
|
||||||
|
|
||||||
#if defined(__WXPM__) || defined(__EMX__)
|
|
||||||
const wxString wxDynamicLibrary::ms_dllext(wxT(".dll"));
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// for MSW/Unix it is defined in platform-specific file
|
// for MSW/Unix it is defined in platform-specific file
|
||||||
#if !(defined(__WINDOWS__) || defined(__UNIX__)) || defined(__EMX__)
|
#if !(defined(__WINDOWS__) || defined(__UNIX__)) || defined(__EMX__)
|
||||||
|
|
||||||
@@ -83,7 +79,7 @@ bool wxDynamicLibrary::Load(const wxString& libnameOrig, int flags)
|
|||||||
wxFileName::SplitPath(libname, NULL, NULL, &ext);
|
wxFileName::SplitPath(libname, NULL, NULL, &ext);
|
||||||
if ( ext.empty() )
|
if ( ext.empty() )
|
||||||
{
|
{
|
||||||
libname += GetDllExt();
|
libname += GetDllExt(wxDL_MODULE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -166,6 +162,29 @@ void *wxDynamicLibrary::GetSymbol(const wxString& name, bool *success) const
|
|||||||
// informational methods
|
// 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*/
|
/*static*/
|
||||||
wxString
|
wxString
|
||||||
wxDynamicLibrary::CanonicalizeName(const wxString& name,
|
wxDynamicLibrary::CanonicalizeName(const wxString& name,
|
||||||
@@ -177,24 +196,18 @@ wxDynamicLibrary::CanonicalizeName(const wxString& name,
|
|||||||
#if defined(__UNIX__) && !defined(__EMX__)
|
#if defined(__UNIX__) && !defined(__EMX__)
|
||||||
switch ( cat )
|
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:
|
case wxDL_LIBRARY:
|
||||||
// library names should start with "lib" under Unix
|
// Library names should start with "lib" under Unix.
|
||||||
nameCanonic = wxT("lib");
|
nameCanonic = "lib";
|
||||||
|
break;
|
||||||
|
case wxDL_MODULE:
|
||||||
|
// Module names are arbitrary and should have no prefix added.
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
#else // !__UNIX__
|
#endif
|
||||||
wxUnusedVar(cat);
|
|
||||||
#endif // __UNIX__/!__UNIX__
|
nameCanonic << name << GetDllExt(cat);
|
||||||
|
|
||||||
nameCanonic << name << GetDllExt();
|
|
||||||
return nameCanonic;
|
return nameCanonic;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -284,7 +284,7 @@ wxPluginManager::LoadLibrary(const wxString &libname, int flags)
|
|||||||
wxString realname(libname);
|
wxString realname(libname);
|
||||||
|
|
||||||
if( !(flags & wxDL_VERBATIM) )
|
if( !(flags & wxDL_VERBATIM) )
|
||||||
realname += wxDynamicLibrary::GetDllExt();
|
realname += wxDynamicLibrary::GetDllExt(wxDL_MODULE);
|
||||||
|
|
||||||
wxPluginLibrary *entry;
|
wxPluginLibrary *entry;
|
||||||
|
|
||||||
@@ -343,7 +343,7 @@ bool wxPluginManager::UnloadLibrary(const wxString& libname)
|
|||||||
|
|
||||||
if ( !entry )
|
if ( !entry )
|
||||||
{
|
{
|
||||||
realname += wxDynamicLibrary::GetDllExt();
|
realname += wxDynamicLibrary::GetDllExt(wxDL_MODULE);
|
||||||
|
|
||||||
entry = FindByName(realname);
|
entry = FindByName(realname);
|
||||||
}
|
}
|
||||||
|
@@ -29,8 +29,6 @@
|
|||||||
#include "wx/msw/debughlp.h"
|
#include "wx/msw/debughlp.h"
|
||||||
#include "wx/filename.h"
|
#include "wx/filename.h"
|
||||||
|
|
||||||
const wxString wxDynamicLibrary::ms_dllext(wxT(".dll"));
|
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
// private classes
|
// private classes
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
|
@@ -65,15 +65,6 @@
|
|||||||
// constants
|
// constants
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
|
|
||||||
// standard shared libraries extensions for different Unix versions
|
|
||||||
#if defined(__HPUX__)
|
|
||||||
const wxString wxDynamicLibrary::ms_dllext(".sl");
|
|
||||||
#elif defined(__DARWIN__)
|
|
||||||
const wxString wxDynamicLibrary::ms_dllext(".bundle");
|
|
||||||
#else
|
|
||||||
const wxString wxDynamicLibrary::ms_dllext(".so");
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// ============================================================================
|
// ============================================================================
|
||||||
// wxDynamicLibrary implementation
|
// wxDynamicLibrary implementation
|
||||||
// ============================================================================
|
// ============================================================================
|
||||||
|
Reference in New Issue
Block a user