-#define wxDllGetSymbol(handle, name) dlsym(handle, name)
-#define wxDllClose dlclose
-
-#elif defined(HAVE_SHL_LOAD)
-#define wxDllOpen(lib) shl_load(lib.fn_str(), BIND_DEFERRED, 0)
-#define wxDllClose shl_unload
-
-static inline void *wxDllGetSymbol(shl_t handle, const wxString& name)
-{
- void *sym;
- return ( shl_findsym(&handle, name.mb_str(), TYPE_UNDEFINED, &sym) == 0 )
- ? sym : 0;
-}
-
-#elif defined(__DARWIN__)
-
- // Porting notes:
- // The dlopen port is a port from dl_next.xs by Anno Siegel.
- // dl_next.xs is itself a port from dl_dlopen.xs by Paul Marquess.
- // The method used here is just to supply the sun style dlopen etc.
- // functions in terms of Darwin NS*.
-
-void *dlopen(const char *path, int mode); // mode is ignored
-void *dlsym(void *handle, const char *symbol);
-int dlclose(void *handle);
-const char *dlerror(void);
-
-#define wxDllOpen(lib) dlopen(lib.fn_str(), 0)
-#define wxDllGetSymbol(handle, name) dlsym(handle, name)
-#define wxDllClose dlclose
-
-#elif defined(__WINDOWS__)
-
- // using LoadLibraryEx under Win32 to avoid name clash with LoadLibrary
-
-#ifdef __WIN32__
-
-#ifdef _UNICODE
-#define wxDllOpen(lib) ::LoadLibraryExW(lib, 0, 0)
-#else
-#define wxDllOpen(lib) ::LoadLibraryExA(lib, 0, 0)
-#endif
-
-#else // Win16
-#define wxDllOpen(lib) ::LoadLibrary(lib)
-#endif // Win32/16
-#define wxDllGetSymbol(handle, name) ::GetProcAddress(handle, name)
-#define wxDllClose ::FreeLibrary
-
-#elif defined(__WXMAC__)
-#define wxDllClose(handle) CloseConnection(&handle)
-#else
-#error "Don't know how to load shared libraries on this platform."
+#include "wx/dynload.h"
+#include "wx/module.h"
+
+#if defined(__DARWIN__)
+/* Porting notes:
+ * The dlopen port is a port from dl_next.xs by Anno Siegel.
+ * dl_next.xs is itself a port from dl_dlopen.xs by Paul Marquess.
+ * The method used here is just to supply the sun style dlopen etc.
+ * functions in terms of Darwin NS*.
+ */
+void *dlopen(const char *path, int mode /* mode is ignored */);
+void *dlsym(void *handle, const char *symbol);
+int dlclose(void *handle);
+const char *dlerror(void);