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__
21 #if wxUSE_DYNLIB_CLASS
23 #include <wx/string.h>
27 // this is normally done by configure, but I leave it here for now...
28 #if defined(__UNIX__) && !(defined(HAVE_DLOPEN) || defined(HAVE_SHL_LOAD))
29 #if defined(__LINUX__) || defined(__SOLARIS__) || defined(__SUNOS__) || defined(__FREEBSD__)
31 #elif defined(__HPUX__)
33 #endif // Unix flavour
34 #endif // !Unix or already have some HAVE_xxx defined
36 #if defined(HAVE_DLOPEN)
39 typedef void *wxDllType
;
40 #elif defined(HAVE_SHL_LOAD)
43 typedef shl_t wxDllType
;
44 #elif defined(__WINDOWS__)
47 typedef HMODULE wxDllType
;
48 #elif defined(__WXMAC__)
49 typedef CFragConnectionID wxDllType
;
51 #error "wxLibrary can't be compiled on this platform, sorry."
54 // defined in windows.h
59 // ----------------------------------------------------------------------------
61 // ----------------------------------------------------------------------------
63 class wxLibrary
: public wxObject
66 wxHashTable classTable
;
69 wxLibrary(wxDllType handle
);
72 // Get a symbol from the dynamic library
73 void *GetSymbol(const wxString
& symbname
);
75 // Create the object whose classname is "name"
76 wxObject
*CreateObject(const wxString
& name
);
79 void PrepareClasses(wxClassInfo
*first
);
84 // ----------------------------------------------------------------------------
86 // ----------------------------------------------------------------------------
94 // caller is responsible for deleting the returned pointer if !NULL
95 wxLibrary
*LoadLibrary(const wxString
& basename
);
97 wxObject
*CreateObject(const wxString
& name
);
103 // ----------------------------------------------------------------------------
105 // ----------------------------------------------------------------------------
107 extern wxLibraries wxTheLibraries
;
109 // ----------------------------------------------------------------------------
110 // Interesting defines
111 // ----------------------------------------------------------------------------
113 #define WXDLL_ENTRY_FUNCTION() \
114 extern "C" wxClassInfo *wxGetClassFirst(); \
115 wxClassInfo *wxGetClassFirst() { \
116 return wxClassInfo::GetFirst(); \
119 #endif // wxUSE_DYNLIB_CLASS
121 #endif // _WX_DYNLIB_H__