+ return wxDllLoader::GetSymbol(m_handle, symbname);
+}
+
+// ---------------------------------------------------------------------------
+// wxDllLoader
+// ---------------------------------------------------------------------------
+
+
+#if defined(__WINDOWS__) || defined(__WXPM__) || defined(__EMX__)
+const wxString wxDllLoader::ms_dllext( _T(".dll") );
+#elif defined(__UNIX__)
+#if defined(__HPUX__)
+const wxString wxDllLoader::ms_dllext( _T(".sl") );
+#else
+const wxString wxDllLoader::ms_dllext( _T(".so") );
+#endif
+#elif defined(__WXMAC__)
+const wxString wxDllLoader::ms_dllext( _T("") );
+#endif
+
+/* static */
+wxDllType wxDllLoader::GetProgramHandle()
+{
+#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;
+ bool failed = FALSE;
+
+#if defined(__WXMAC__) && !defined(__UNIX__)
+ FSSpec myFSSpec;
+ Ptr myMainAddr;
+ Str255 myErrName;
+
+ wxMacFilename2FSSpec( libname , &myFSSpec );
+
+ if( GetDiskFragment( &myFSSpec,
+ 0,
+ kCFragGoesToEOF,
+ "\p",
+ kPrivateCFragCopy,
+ &((CFragConnectionID)handle),
+ &myMainAddr,
+ myErrName ) != noErr )
+ {
+ p2cstr( myErrName );
+ wxLogSysError( _("Failed to load shared library '%s' Error '%s'"),
+ libname.c_str(),
+ (char*)myErrName );
+ handle = 0;
+ failed = TRUE;
+ }
+
+#elif defined(__WXPM__) || defined(__EMX__)
+ char zError[256] = "";
+ wxDllOpen(zError, libname, handle);
+
+#else
+ handle = wxDllOpen(libname);
+
+#endif
+
+ if ( !handle )
+ {
+ wxString msg(_("Failed to load shared library '%s'"));
+
+#ifdef HAVE_DLERROR
+ const wxChar *err = dlerror();
+ if( err )
+ {
+ failed = TRUE;
+ wxLogError( msg, err );
+ }
+#else
+ failed = TRUE;
+ wxLogSysError( msg, libname.c_str() );
+#endif
+ }
+
+ if ( success )
+ *success = !failed;
+
+ return handle;
+}
+
+
+/* static */
+void wxDllLoader::UnloadLibrary(wxDllType handle)
+{
+ wxDllClose(handle);
+}
+
+/* static */
+void *wxDllLoader::GetSymbol(wxDllType dllHandle, const wxString &name, bool *success)
+{
+ bool failed = FALSE;
+ void *symbol = 0;
+
+#if defined(__WXMAC__) && !defined(__UNIX__)
+ Ptr symAddress;
+ CFragSymbolClass symClass;
+ Str255 symName;
+
+#if TARGET_CARBON
+ c2pstrcpy( (StringPtr) symName, name );
+#else
+ strcpy( (char *) symName, name );
+ c2pstr( (char *) symName );