+ #error "Dynamic Loading classes can't be compiled on this platform, sorry."
+#endif
+
+// ----------------------------------------------------------------------------
+// constants
+// ----------------------------------------------------------------------------
+
+enum wxDLFlags
+{
+ wxDL_LAZY = 0x00000001, // resolve undefined symbols at first use
+ // (only works on some Unix versions)
+ wxDL_NOW = 0x00000002, // resolve undefined symbols on load
+ // (default, always the case under Win32)
+ wxDL_GLOBAL = 0x00000004, // export extern symbols to subsequently
+ // loaded libs.
+ 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
+ // (only for wxPluginManager)
+
+ wxDL_DEFAULT = wxDL_NOW // default flags correspond to Win32
+};
+
+enum wxDynamicLibraryCategory
+{
+ wxDL_LIBRARY, // standard library
+ wxDL_MODULE // loadable module/plugin
+};
+
+enum wxPluginCategory
+{
+ wxDL_PLUGIN_GUI, // plugin that uses GUI classes
+ wxDL_PLUGIN_BASE // wxBase-only plugin
+};
+
+// ----------------------------------------------------------------------------
+// macros
+// ----------------------------------------------------------------------------
+
+// when loading a function from a DLL you always have to cast the returned
+// "void *" pointer to the correct type and, even more annoyingly, you have to
+// repeat this type twice if you want to declare and define a function pointer
+// all in one line
+//
+// this macro makes this slightly less painful by allowing you to specify the
+// type only once, as the first parameter, and creating a variable of this type
+// called "pfn<name>" initialized with the "name" from the "dynlib"
+#define wxDYNLIB_FUNCTION(type, name, dynlib) \
+ type pfn ## name = (type)(dynlib).GetSymbol(_T(#name))
+
+// ----------------------------------------------------------------------------
+// wxDynamicLibraryDetails: contains details about a loaded wxDynamicLibrary
+// ----------------------------------------------------------------------------
+
+class WXDLLIMPEXP_BASE wxDynamicLibraryDetails
+{
+public:
+ // ctor, normally never used as these objects are only created by
+ // wxDynamicLibrary::ListLoaded()
+ wxDynamicLibraryDetails() { m_address = NULL; m_length = 0; }
+
+ // get the (base) name
+ wxString GetName() const { return m_name; }
+
+ // get the full path of this object
+ wxString GetPath() const { return m_path; }
+
+ // get the load address and the extent, return true if this information is
+ // available
+ bool GetAddress(void **addr, size_t *len) const
+ {
+ if ( !m_address )
+ return false;
+
+ if ( addr )
+ *addr = m_address;
+ if ( len )
+ *len = m_length;
+
+ return true;
+ }
+
+ // return the version of the DLL (may be empty if no version info)
+ wxString GetVersion() const
+ {
+ return m_version;
+ }
+
+private:
+ wxString m_name,
+ m_path,
+ m_version;
+
+ void *m_address;
+ size_t m_length;
+
+ friend class wxDynamicLibraryDetailsCreator;
+};
+
+WX_DECLARE_USER_EXPORTED_OBJARRAY(wxDynamicLibraryDetails,
+ wxDynamicLibraryDetailsArray,
+ WXDLLIMPEXP_BASE);
+
+// ----------------------------------------------------------------------------
+// wxDynamicLibrary: represents a handle to a DLL/shared object
+// ----------------------------------------------------------------------------
+
+class WXDLLIMPEXP_BASE wxDynamicLibrary
+{
+public:
+ // return a valid handle for the main program itself or NULL if back
+ // linking is not supported by the current platform (e.g. Win32)
+ static wxDllType GetProgramHandle();
+
+ // return the platform standard DLL extension (with leading dot)
+ static const wxChar *GetDllExt() { return ms_dllext; }