+// TODO should be done by configure
+#if defined(__UNIX__) && !(defined(HAVE_DLOPEN) || defined(HAVE_SHLLOAD))
+ #if defined(__LINUX__) || defined(__SOLARIS__) || defined(__SUNOS__)
+ #ifndef HAVE_DLOPEN
+ #define HAVE_DLOPEN
+ #endif
+ #elif defined(__HPUX__)
+ #ifndef HAVE_SHLLOAD
+ #define HAVE_SHLLOAD
+ #endif
+ #endif // Unix flavour
+#endif // !Unix or already have some HAVE_xxx defined
+
+#include "wx/dynlib.h"
+#include "wx/filefn.h"
+#include "wx/intl.h"
+#include "wx/log.h"
+
+// ----------------------------------------------------------------------------
+// conditional compilation
+// ----------------------------------------------------------------------------
+
+#if defined(HAVE_DLOPEN)
+ #define wxDllOpen(lib) dlopen(lib, RTLD_LAZY)
+ #define wxDllGetSymbol(handle, name) dlsym(handle, (char *)name)
+ #define wxDllClose dlclose
+#elif defined(HAVE_SHLLOAD)
+ #define wxDllOpen(lib) shl_open(lib, BIND_DEFERRED, 0)
+ #define wxDllClose shl_unload
+
+ static inline void *wxDllGetSymbol(shl_t *handle, const char *name)
+ {
+ void *sym;
+ if ( shl_findsym(handle, name, TYPE_UNDEFINED, &sym) == 0 )
+ return sym;
+ else
+ return (void *)0;
+ }
+#elif defined(__WINDOWS__)
+ #define wxDllOpen(lib) ::LoadLibrary(lib)
+ #define wxDllGetSymbol(handle, name) ::GetProcAddress(handle, name)
+ #define wxDllClose ::FreeLibrary
+#else
+ #error "Don't know how to load shared libraries on this platform."
+#endif // OS