1 /////////////////////////////////////////////////////////////////////////////
3 // Purpose: Dynamic library management
4 // Author: Guilhem Lavaux
8 // Copyright: (c) Guilhem Lavaux
9 // Licence: wxWindows license
10 /////////////////////////////////////////////////////////////////////////////
12 #ifndef _WX_DYNLIB_H__
13 #define _WX_DYNLIB_H__
19 #include <wx/string.h>
23 // TODO should be done by configure
24 #if defined(__UNIX__) && !(defined(HAVE_DLOPEN) || defined(HAVE_SHLLOAD))
25 #if defined(__LINUX__) || defined(__SOLARIS__) || defined(__SUNOS__) || defined(__FREEBSD__)
27 #elif defined(__HPUX__)
29 #endif // Unix flavour
30 #endif // !Unix or already have some HAVE_xxx defined
32 #if defined(HAVE_DLOPEN)
35 typedef void *wxDllType
;
36 #elif defined(HAVE_SHLLOAD)
39 typedef void *wxDllType
;
40 #elif defined(__WINDOWS__)
43 typedef HMODULE wxDllType
;
44 #elif defined(__WXMAC__)
45 typedef CFragConnectionID wxDllType
;
47 #error "wxLibrary can't be compiled on this platform, sorry."
50 // defined in windows.h
55 // ----------------------------------------------------------------------------
57 // ----------------------------------------------------------------------------
59 class wxLibrary
: public wxObject
62 wxHashTable classTable
;
65 wxLibrary(void *handle
);
68 // Get a symbol from the dynamic library
69 void *GetSymbol(const wxString
& symbname
);
71 // Create the object whose classname is "name"
72 wxObject
*CreateObject(const wxString
& name
);
75 void PrepareClasses(wxClassInfo
*first
);
80 // ----------------------------------------------------------------------------
82 // ----------------------------------------------------------------------------
90 // caller is responsible for deleting the returned pointer if !NULL
91 wxLibrary
*LoadLibrary(const wxString
& basename
);
93 wxObject
*CreateObject(const wxString
& name
);
99 // ----------------------------------------------------------------------------
101 // ----------------------------------------------------------------------------
103 extern wxLibraries wxTheLibraries
;
105 // ----------------------------------------------------------------------------
106 // Interesting defines
107 // ----------------------------------------------------------------------------
109 #define WXDLL_ENTRY_FUNCTION() \
110 extern "C" wxClassInfo *wxGetClassFirst(); \
111 wxClassInfo *wxGetClassFirst() { \
112 return wxClassInfo::GetFirst(); \
115 #endif // _WX_DYNLIB_H__