]> git.saurik.com Git - wxWidgets.git/blob - include/wx/dynlib.h
Tries unsuccesfully to cure a few more problems
[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 // ---------------------------------------------------------------------------
14 // wxLibrary
15
16 class wxLibrary: public wxObject {
17 protected:
18 void *m_handle;
19 bool m_destroy;
20 public:
21 wxHashTable classTable;
22
23 public:
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
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);
39 };
40
41 // ---------------------------------------------------------------------------
42 // wxLibraries
43
44 class wxLibraries {
45 protected:
46 wxList m_loaded;
47 public:
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
63 #define WXDLL_ENTRY_FUNCTION() \
64 extern "C" wxClassInfo **wxGetClassFirst(); \
65 wxClassInfo **wxGetClassFirst() { \
66 return &wxClassInfo::first; \
67 }
68
69 #endif