+{
+ return wxDllLoader::GetSymbol(m_handle, symbname);
+}
+
+// ---------------------------------------------------------------------------
+// wxDllLoader
+// ---------------------------------------------------------------------------
+
+/* static */
+wxString wxDllLoader::GetDllExt()
+{
+ wxString ext;
+
+#if defined(__WINDOWS__) || defined(__WXPM__) || defined(__EMX__)
+ ext = _T(".dll");
+#elif defined(__UNIX__)
+# if defined(__HPUX__)
+ ext = _T(".sl");
+# else //__HPUX__
+ ext = _T(".so");
+# endif //__HPUX__
+#endif
+
+ return ext;
+}
+
+/* static */
+wxDllType
+wxDllLoader::GetProgramHandle(void)
+{
+#if defined( HAVE_DLOPEN ) && !defined(__EMX__)
+ // optain handle for main program
+ return dlopen(NULL, RTLD_NOW/*RTLD_LAZY*/);
+#elif defined (HAVE_SHL_LOAD)
+ // shl_findsymbol with NULL handle looks up in main program
+ return 0;
+#else
+ wxFAIL_MSG( wxT("This method is not implemented under Windows or OS/2"));
+ return 0;
+#endif
+}
+
+/* static */
+wxDllType
+wxDllLoader::LoadLibrary(const wxString & libname, bool *success)
+{
+ wxDllType handle;
+
+#if defined(__WXMAC__) && !defined(__UNIX__)
+ FSSpec myFSSpec ;
+ Ptr myMainAddr ;
+ Str255 myErrName ;
+
+ wxMacPathToFSSpec( libname , &myFSSpec ) ;
+ if (GetDiskFragment( &myFSSpec , 0 , kCFragGoesToEOF , "\p" , kPrivateCFragCopy , &handle , &myMainAddr ,
+ myErrName ) != noErr )
+ {
+ p2cstr( myErrName ) ;
+ wxASSERT_MSG( 1 , (char*)myErrName ) ;
+ return NULL ;
+ }
+#elif defined(__WXPM__) || defined(__EMX__)
+ char zError[256] = "";
+ wxDllOpen(zError, libname, handle);
+#else // !Mac
+ handle = wxDllOpen(libname);
+#endif // OS
+
+ if ( !handle )
+ {
+ wxString msg(_("Failed to load shared library '%s'"));
+
+#ifdef HAVE_DLERROR
+ const char *errmsg = dlerror();
+ if ( errmsg )
+ {
+ // the error string format is "libname: ...", but we already have
+ // libname, so cut it off
+ const char *p = strchr(errmsg, ':');
+ if ( p )
+ {
+ if ( *++p == ' ' )
+ p++;
+ }
+ else
+ {
+ p = errmsg;
+ }
+
+ msg += _T(" (%s)");
+ wxLogError(msg, libname.c_str(), p);
+ }
+ else
+#endif // HAVE_DLERROR
+ {
+ wxLogSysError(msg, libname.c_str());
+ }
+ }
+
+ if ( success )
+ {
+ *success = handle != 0;
+ }
+
+ return handle;
+}
+
+
+/* static */
+void
+wxDllLoader::UnloadLibrary(wxDllType handle)
+{
+ wxDllClose(handle);
+}
+
+/* static */
+void *
+wxDllLoader::GetSymbol(wxDllType dllHandle, const wxString &name)