]>
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 GL |
12 | |
13 | // --------------------------------------------------------------------------- | |
14 | // wxLibrary | |
15 | ||
16 | class wxLibrary: public wxObject { | |
f4a8c29f | 17 | protected: |
7a4b9130 | 18 | void *m_handle; |
f4a8c29f GL |
19 | bool m_destroy; |
20 | public: | |
21 | wxHashTable classTable; | |
22 | ||
23 | public: | |
7a4b9130 GL |
24 | wxLibrary(void *handle); |
25 | ~wxLibrary(void); | |
26 | ||
27 | // Get a symbol from the dynamic library | |
28 | void *GetSymbol(const wxString& symbname); | |
29 | ||
30 | // Create the object whose classname is "name" | |
31 | wxObject *CreateObject(const wxString& name); | |
32 | ||
f4a8c29f GL |
33 | // Merge the symbols with the main symbols: WARNING! the library will not |
34 | // be unloaded. | |
35 | void MergeWithSystem(); | |
36 | ||
37 | protected: | |
38 | void PrepareClasses(wxClassInfo **first); | |
7a4b9130 GL |
39 | }; |
40 | ||
41 | // --------------------------------------------------------------------------- | |
42 | // wxLibraries | |
43 | ||
44 | class wxLibraries { | |
f4a8c29f | 45 | protected: |
7a4b9130 | 46 | wxList m_loaded; |
f4a8c29f | 47 | public: |
7a4b9130 GL |
48 | wxLibraries(void); |
49 | ~wxLibraries(void); | |
50 | ||
51 | wxLibrary *LoadLibrary(const wxString& name); | |
52 | wxObject *CreateObject(const wxString& name); | |
53 | }; | |
54 | ||
55 | // --------------------------------------------------------------------------- | |
56 | // Global variables | |
57 | ||
58 | extern wxLibraries wxTheLibraries; | |
59 | ||
60 | // --------------------------------------------------------------------------- | |
61 | // Interesting defines | |
62 | ||
f4a8c29f GL |
63 | #define WXDLL_ENTRY_FUNCTION() \ |
64 | extern "C" wxClassInfo **wxGetClassFirst(); \ | |
65 | wxClassInfo **wxGetClassFirst() { \ | |
66 | return &wxClassInfo::first; \ | |
67 | } | |
7a4b9130 GL |
68 | |
69 | #endif |