X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/9a83f860948059b0273b5cc6d9e43fadad3ebfca..8fdbcf4de8eeff67ccfaf3deec833d203f112629:/src/common/dynlib.cpp?ds=sidebyside diff --git a/src/common/dynlib.cpp b/src/common/dynlib.cpp index d8ab264fb4..0d76254a0f 100644 --- a/src/common/dynlib.cpp +++ b/src/common/dynlib.cpp @@ -54,12 +54,8 @@ 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(__WXMSW__) || defined(__UNIX__)) || defined(__EMX__) +#if !(defined(__WINDOWS__) || defined(__UNIX__)) || defined(__EMX__) wxDllType wxDynamicLibrary::GetProgramHandle() { @@ -67,7 +63,7 @@ wxDllType wxDynamicLibrary::GetProgramHandle() return 0; } -#endif // __WXMSW__ || __UNIX__ +#endif // __WINDOWS__ || __UNIX__ bool wxDynamicLibrary::Load(const wxString& libnameOrig, int flags) @@ -83,7 +79,7 @@ bool wxDynamicLibrary::Load(const wxString& libnameOrig, int flags) wxFileName::SplitPath(libname, NULL, NULL, &ext); if ( ext.empty() ) { - libname += GetDllExt(); + libname += GetDllExt(wxDL_MODULE); } } @@ -112,7 +108,7 @@ bool wxDynamicLibrary::Load(const wxString& libnameOrig, int flags) // for MSW and Unix this is implemented in the platform-specific file // // TODO: move the rest to os2/dlpm.cpp and mac/dlmac.cpp! -#if (!defined(__WXMSW__) && !defined(__UNIX__)) || defined(__EMX__) +#if (!defined(__WINDOWS__) && !defined(__UNIX__)) || defined(__EMX__) /* static */ void wxDynamicLibrary::Unload(wxDllType handle) @@ -124,7 +120,7 @@ void wxDynamicLibrary::Unload(wxDllType handle) #endif } -#endif // !(__WXMSW__ || __UNIX__) +#endif // !(__WINDOWS__ || __UNIX__) void *wxDynamicLibrary::DoGetSymbol(const wxString &name, bool *success) const { @@ -166,6 +162,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 +196,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; }