X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/dabd1377ce769598bda630dfad548be055e2a89b..b89f23763c6bfcc2e20698cfdea63152d95e856e:/include/wx/dynload.h?ds=sidebyside diff --git a/include/wx/dynload.h b/include/wx/dynload.h index 4cfd2b5de8..a1c19d73a9 100644 --- a/include/wx/dynload.h +++ b/include/wx/dynload.h @@ -13,7 +13,7 @@ #ifndef _WX_DYNAMICLOADER_H__ #define _WX_DYNAMICLOADER_H__ -#ifdef __GNUG__ +#if defined(__GNUG__) && !defined(__APPLE__) #pragma interface "dynload.h" #endif @@ -25,7 +25,7 @@ #if wxUSE_DYNAMIC_LOADER -#include "wx/hash.h" +#include "wx/hashmap.h" #include "wx/module.h" // FIXME: can this go in private.h or something too?? @@ -38,11 +38,10 @@ #include "wx/msw/private.h" #endif -// Ugh, I'd much rather this was typesafe, but no time -// to rewrite wxHashTable right now.. +class WXDLLEXPORT wxPluginLibrary; -typedef wxHashTable wxDLManifest; -typedef wxHashTable wxDLImports; +WX_DECLARE_EXPORTED_STRING_HASH_MAP(wxPluginLibrary *, wxDLManifest); +typedef wxDLManifest wxDLImports; // ---------------------------------------------------------------------------- // conditional compilation @@ -87,6 +86,10 @@ enum wxDLFlags wxDL_VERBATIM = 0x00000008, // Attempt to load the supplied library // name without appending the usual dll // filename extension. + + wxDL_NOSHARE = 0x00000010, // load new DLL, don't reuse already loaded + + // FIXME: why? (VZ) #ifdef __osf__ wxDL_DEFAULT = wxDL_LAZY #else @@ -106,7 +109,7 @@ public: // return the platform standard DLL extension (with leading dot) - static const wxString &GetDllExt() { return ms_dllext; } + static const wxChar *GetDllExt() { return ms_dllext; } wxDynamicLibrary() : m_handle(0) {} wxDynamicLibrary(wxString libname, int flags = wxDL_DEFAULT) @@ -155,7 +158,7 @@ protected: // Platform specific shared lib suffix. - static const wxString ms_dllext; + static const wxChar *ms_dllext; // the handle to DLL or NULL @@ -164,7 +167,7 @@ protected: // no copy ctor/assignment operators // or we'd try to unload the library twice -DECLARE_NO_COPY_CLASS(wxDynamicLibrary) + DECLARE_NO_COPY_CLASS(wxDynamicLibrary) }; @@ -189,7 +192,7 @@ public: wxPluginLibrary( const wxString &libname, int flags = wxDL_DEFAULT ); ~wxPluginLibrary(); - wxPluginLibrary *RefLib() { ++m_linkcount; return this; } + wxPluginLibrary *RefLib(); bool UnrefLib(); // These two are called by the PluginSentinel on (PLUGGABLE) object @@ -230,7 +233,7 @@ private: void RegisterModules(); // Init any wxModules in the lib. void UnregisterModules(); // Cleanup any wxModules we installed. -DECLARE_NO_COPY_CLASS(wxPluginLibrary) + DECLARE_NO_COPY_CLASS(wxPluginLibrary) }; @@ -253,7 +256,7 @@ public: // Instance methods. - wxPluginManager() : m_entry(0) {}; + wxPluginManager() : m_entry(NULL) {}; wxPluginManager(const wxString &libname, int flags = wxDL_DEFAULT) { Load(libname, flags); @@ -273,14 +276,21 @@ public: static void ClearManifest() { delete ms_manifest; ms_manifest = NULL; } private: + // return the pointer to the entry for the library with given name in + // ms_manifest or NULL if none + static wxPluginLibrary *FindByName(const wxString& name) + { + const wxDLManifest::iterator i = ms_manifest->find(name); + + return i == ms_manifest->end() ? NULL : i->second; + } static wxDLManifest* ms_manifest; // Static hash of loaded libs. wxPluginLibrary* m_entry; // Cache our entry in the manifest. // We could allow this class to be copied if we really // wanted to, but not without modification. - -DECLARE_NO_COPY_CLASS(wxPluginManager) + DECLARE_NO_COPY_CLASS(wxPluginManager) }; @@ -297,14 +307,14 @@ class WXDLLEXPORT wxDllLoader { public: - static wxDllType LoadLibrary(const wxString& name); + static wxDllType LoadLibrary(const wxString& name, bool *success = NULL); static void UnloadLibrary(wxDllType dll); static wxDllType GetProgramHandle() { return wxDynamicLibrary::GetProgramHandle(); } static void *GetSymbol(wxDllType dllHandle, const wxString &name, bool *success = 0); - static const wxString &GetDllExt() { return wxDynamicLibrary::GetDllExt(); } + static wxString GetDllExt() { return wxDynamicLibrary::GetDllExt(); } private: @@ -312,8 +322,6 @@ private: }; #endif - #endif // wxUSE_DYNAMIC_LOADER #endif // _WX_DYNAMICLOADER_H__ -// vi:sts=4:sw=4:et