1998-08-14 20:23:28 -04:00
|
|
|
#ifndef _WX_DYNLIB_H__
|
|
|
|
#define _WX_DYNLIB_H__
|
1998-08-04 13:49:26 -04:00
|
|
|
|
|
|
|
#ifdef __GNUG__
|
|
|
|
#pragma interface
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#include <wx/string.h>
|
|
|
|
#include <wx/list.h>
|
|
|
|
#include <wx/dynarray.h>
|
1998-09-01 13:17:05 -04:00
|
|
|
#include <wx/hash.h>
|
1998-08-04 13:49:26 -04:00
|
|
|
|
1998-09-10 07:41:14 -04:00
|
|
|
#ifdef LoadLibrary
|
|
|
|
#undef LoadLibrary
|
|
|
|
#endif
|
|
|
|
|
1998-08-04 13:49:26 -04:00
|
|
|
// ---------------------------------------------------------------------------
|
|
|
|
// wxLibrary
|
|
|
|
|
|
|
|
class wxLibrary: public wxObject {
|
1998-09-01 13:17:05 -04:00
|
|
|
protected:
|
1998-08-04 13:49:26 -04:00
|
|
|
void *m_handle;
|
1998-09-01 13:17:05 -04:00
|
|
|
bool m_destroy;
|
|
|
|
public:
|
|
|
|
wxHashTable classTable;
|
|
|
|
|
|
|
|
public:
|
1998-08-04 13:49:26 -04:00
|
|
|
wxLibrary(void *handle);
|
|
|
|
~wxLibrary(void);
|
|
|
|
|
|
|
|
// Get a symbol from the dynamic library
|
|
|
|
void *GetSymbol(const wxString& symbname);
|
|
|
|
|
|
|
|
// Create the object whose classname is "name"
|
|
|
|
wxObject *CreateObject(const wxString& name);
|
|
|
|
|
1998-09-01 13:17:05 -04:00
|
|
|
// Merge the symbols with the main symbols: WARNING! the library will not
|
|
|
|
// be unloaded.
|
|
|
|
void MergeWithSystem();
|
|
|
|
|
|
|
|
protected:
|
|
|
|
void PrepareClasses(wxClassInfo **first);
|
1998-08-04 13:49:26 -04:00
|
|
|
};
|
|
|
|
|
|
|
|
// ---------------------------------------------------------------------------
|
|
|
|
// wxLibraries
|
|
|
|
|
|
|
|
class wxLibraries {
|
1998-09-01 13:17:05 -04:00
|
|
|
protected:
|
1998-08-04 13:49:26 -04:00
|
|
|
wxList m_loaded;
|
1998-09-01 13:17:05 -04:00
|
|
|
public:
|
1998-08-04 13:49:26 -04:00
|
|
|
wxLibraries(void);
|
|
|
|
~wxLibraries(void);
|
|
|
|
|
|
|
|
wxLibrary *LoadLibrary(const wxString& name);
|
|
|
|
wxObject *CreateObject(const wxString& name);
|
|
|
|
};
|
|
|
|
|
|
|
|
// ---------------------------------------------------------------------------
|
|
|
|
// Global variables
|
|
|
|
|
|
|
|
extern wxLibraries wxTheLibraries;
|
|
|
|
|
|
|
|
// ---------------------------------------------------------------------------
|
|
|
|
// Interesting defines
|
|
|
|
|
1998-09-01 13:17:05 -04:00
|
|
|
#define WXDLL_ENTRY_FUNCTION() \
|
|
|
|
extern "C" wxClassInfo **wxGetClassFirst(); \
|
|
|
|
wxClassInfo **wxGetClassFirst() { \
|
|
|
|
return &wxClassInfo::first; \
|
|
|
|
}
|
1998-08-04 13:49:26 -04:00
|
|
|
|
|
|
|
#endif
|