]> git.saurik.com Git - wxWidgets.git/blob - include/wx/dynlib.h
CW Win32 and Mac adaptions
[wxWidgets.git] / include / wx / dynlib.h
1 #ifndef _WX_DYNLIB_H__
2 #define _WX_DYNLIB_H__
3
4 #ifdef __GNUG__
5 #pragma interface
6 #endif
7
8 #include <wx/string.h>
9 #include <wx/list.h>
10 #include <wx/dynarray.h>
11 #include <wx/hash.h>
12
13 #ifdef LoadLibrary
14 #undef LoadLibrary
15 #endif
16
17 // ---------------------------------------------------------------------------
18 // wxLibrary
19
20 class wxLibrary: public wxObject {
21 protected:
22 void *m_handle;
23 bool m_destroy;
24 public:
25 wxHashTable classTable;
26
27 public:
28 wxLibrary(void *handle);
29 ~wxLibrary(void);
30
31 // Get a symbol from the dynamic library
32 void *GetSymbol(const wxString& symbname);
33
34 // Create the object whose classname is "name"
35 wxObject *CreateObject(const wxString& name);
36
37 // Merge the symbols with the main symbols: WARNING! the library will not
38 // be unloaded.
39 void MergeWithSystem();
40
41 protected:
42 void PrepareClasses(wxClassInfo *first);
43 };
44
45 // ---------------------------------------------------------------------------
46 // wxLibraries
47
48 class wxLibraries {
49 protected:
50 wxList m_loaded;
51 public:
52 wxLibraries(void);
53 ~wxLibraries(void);
54
55 wxLibrary *LoadLibrary(const wxString& name);
56 wxObject *CreateObject(const wxString& name);
57 };
58
59 // ---------------------------------------------------------------------------
60 // Global variables
61
62 extern wxLibraries wxTheLibraries;
63
64 // ---------------------------------------------------------------------------
65 // Interesting defines
66
67 #define WXDLL_ENTRY_FUNCTION() \
68 extern "C" wxClassInfo *wxGetClassFirst(); \
69 wxClassInfo *wxGetClassFirst() { \
70 return wxClassInfo::GetFirst(); \
71 }
72
73 #endif