+ wxASSERT_MSG(m_handle == 0, _T("Library already loaded."));
+
+ // add the proper extension for the DLL ourselves unless told not to
+ wxString libname = libnameOrig;
+ if ( !(flags & wxDL_VERBATIM) )
+ {
+ // and also check that the libname doesn't already have it
+ wxString ext;
+ wxFileName::SplitPath(libname, NULL, NULL, &ext);
+ if ( ext.empty() )
+ {
+ libname += GetDllExt();
+ }
+ }
+
+ // different ways to load a shared library
+ //
+ // FIXME: should go to the platform-specific files!
+#if defined(__WXMAC__) && !defined(__DARWIN__)
+ FSSpec myFSSpec;
+ Ptr myMainAddr;
+ Str255 myErrName;
+
+ wxMacFilename2FSSpec( libname , &myFSSpec );
+
+ if( GetDiskFragment( &myFSSpec,
+ 0,
+ kCFragGoesToEOF,
+ "\p",
+ kPrivateCFragCopy,
+ &m_handle,
+ &myMainAddr,
+ myErrName ) != noErr )
+ {
+ wxLogSysError( _("Failed to load shared library '%s' Error '%s'"),
+ libname.c_str(),
+ wxMacMakeStringFromPascal( myErrName ).c_str() );
+ m_handle = 0;
+ }
+
+#elif defined(__WXPM__) || defined(__EMX__)
+ char err[256] = "";
+ DosLoadModule(err, sizeof(err), libname.c_str(), &m_handle);
+#else
+ m_handle = RawLoad(libname, flags);
+#endif