- if ( FindSymbol( m_handle , symName , &symAddress , &symClass ) == noErr )
- {
- symbol = (void *)symAddress ;
- }
+ return 0;
+#endif
+}
+
+
+/* static */
+wxDllType
+wxDllLoader::LoadLibrary(const wxString & lib_name, bool *success)
+{
+ wxASSERT(success);
+
+ wxDllType handle;
+
+#if defined(__WXMAC__)
+ FSSpec myFSSpec ;
+ Ptr myMainAddr ;
+ Str255 myErrName ;
+
+ wxMacPathToFSSpec( lib_name , &myFSSpec ) ;
+ if (GetDiskFragment( &myFSSpec , 0 , kCFragGoesToEOF , "\p" , kPrivateCFragCopy , &handle , &myMainAddr ,
+ myErrName ) != noErr )
+ {
+ p2cstr( myErrName ) ;
+ wxASSERT_MSG( 1 , (char*)myErrName ) ;
+ return NULL ;
+ }
+#else // !Mac
+ handle = wxDllOpen(lib_name);
+#endif // OS
+
+ if ( !handle )
+ {
+ wxLogSysError(_("Failed to load shared library '%s'"),
+ lib_name.c_str());
+ *success = FALSE;
+ return NULL;
+ }
+ *success = TRUE;
+ return handle;
+}
+
+
+/* static */
+void
+wxDllLoader::UnloadLibrary(wxDllType handle)
+{
+ wxDllClose(handle);
+}
+
+/* static */
+void *
+wxDllLoader::GetSymbol(wxDllType dllHandle, const wxString &name)
+{
+ void *symbol = NULL; // return value
+
+#if defined( __WXMAC__ )
+ Ptr symAddress ;
+ CFragSymbolClass symClass ;
+ Str255 symName ;
+
+ strcpy( (char*) symName , name ) ;
+ c2pstr( (char*) symName ) ;
+
+ if ( FindSymbol( dllHandle , symName , &symAddress , &symClass ) == noErr )
+ symbol = (void *)symAddress ;