]>
Commit | Line | Data |
---|---|---|
34138703 JS |
1 | #ifndef _WX_DYNLIB_H__ |
2 | #define _WX_DYNLIB_H__ | |
7a4b9130 GL |
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> | |
f4a8c29f | 11 | #include <wx/hash.h> |
7a4b9130 | 12 | |
0c32066b JS |
13 | #ifdef LoadLibrary |
14 | #undef LoadLibrary | |
15 | #endif | |
16 | ||
7a4b9130 GL |
17 | // --------------------------------------------------------------------------- |
18 | // wxLibrary | |
19 | ||
20 | class wxLibrary: public wxObject { | |
f4a8c29f | 21 | protected: |
7a4b9130 | 22 | void *m_handle; |
f4a8c29f GL |
23 | bool m_destroy; |
24 | public: | |
25 | wxHashTable classTable; | |
26 | ||
27 | public: | |
7a4b9130 GL |
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 | ||
f4a8c29f GL |
37 | // Merge the symbols with the main symbols: WARNING! the library will not |
38 | // be unloaded. | |
39 | void MergeWithSystem(); | |
40 | ||
41 | protected: | |
856d2e52 | 42 | void PrepareClasses(wxClassInfo *first); |
7a4b9130 GL |
43 | }; |
44 | ||
45 | // --------------------------------------------------------------------------- | |
46 | // wxLibraries | |
47 | ||
48 | class wxLibraries { | |
f4a8c29f | 49 | protected: |
7a4b9130 | 50 | wxList m_loaded; |
f4a8c29f | 51 | public: |
7a4b9130 GL |
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 | ||
f4a8c29f | 67 | #define WXDLL_ENTRY_FUNCTION() \ |
856d2e52 GL |
68 | extern "C" wxClassInfo *wxGetClassFirst(); \ |
69 | wxClassInfo *wxGetClassFirst() { \ | |
70 | return wxClassInfo::GetFirst(); \ | |
f4a8c29f | 71 | } |
7a4b9130 GL |
72 | |
73 | #endif |