-#include <wx/string.h>
-#include <wx/list.h>
-#include <wx/dynarray.h>
-
-// ---------------------------------------------------------------------------
-// Some more info on a class
-
-typedef struct {
- wxClassInfo *class_info;
- wxString path;
-} wxClassLibInfo;
-
-// ---------------------------------------------------------------------------
-// Useful arrays
-
-WX_DEFINE_ARRAY(wxClassInfo *, wxArrayClassInfo);
-WX_DEFINE_ARRAY(wxClassLibInfo *, wxArrayClassLibInfo);
-
-// ---------------------------------------------------------------------------
-// wxClassLibrary
+#include "wx/setup.h"
+
+#if wxUSE_DYNAMIC_LOADER
+
+#include "wx/dynload.h" // Use the new (version of) wxDynamicLibrary instead
+
+#elif wxUSE_DYNLIB_CLASS
+
+#include "wx/string.h"
+#include "wx/list.h"
+#include "wx/hash.h"
+
+// this is normally done by configure, but I leave it here for now...
+#if defined(__UNIX__) && !(defined(HAVE_DLOPEN) || defined(HAVE_SHL_LOAD))
+# if defined(__LINUX__) || defined(__SOLARIS__) || defined(__SUNOS__) || defined(__FREEBSD__)
+# define HAVE_DLOPEN
+# elif defined(__HPUX__)
+# define HAVE_SHL_LOAD
+# endif // Unix flavour
+#endif // !Unix or already have some HAVE_xxx defined
+
+// Note: WXPM/EMX has to be tested first, since we want to use
+// native version, even if configure detected presence of DLOPEN.
+#if defined(__WXPM__) || defined(__EMX__)
+# define INCL_DOS
+# include <os2.h>
+ typedef HMODULE wxDllType;
+#elif defined(HAVE_DLOPEN)
+# include <dlfcn.h>
+ typedef void *wxDllType;
+#elif defined(HAVE_SHL_LOAD)
+# include <dl.h>
+ typedef shl_t wxDllType;
+#elif defined(__WINDOWS__)
+# include <windows.h> // needed to get HMODULE
+ typedef HMODULE wxDllType;
+#elif defined(__DARWIN__)
+ typedef void *wxDllType;
+#elif defined(__WXMAC__)
+ typedef void *wxDllType;
+#else
+# error "wxLibrary can't be compiled on this platform, sorry."
+#endif // OS
+
+// LoadLibrary is defined in windows.h as LoadLibraryA, but wxDllLoader method
+// should be called LoadLibrary, not LoadLibraryA or LoadLibraryW!
+#if defined(__WIN32__) && defined(LoadLibrary)
+# include "wx/msw/winundef.h"
+#endif