-#elif defined(__WINDOWS__)
- m_handle = ::LoadLibrary(libname.c_str());
-
-#else
-#error "runtime shared lib support not implemented"
-#endif
-
- if ( m_handle == 0 )
- {
- wxString msg(_("Failed to load shared library '%s'"));
-#if defined(HAVE_DLERROR) && !defined(__EMX__)
- const wxChar *err = dlerror();
- if( err )
- wxLogError( msg, err );
-#else
- wxLogSysError( msg, libname.c_str() );
-#endif
- }
-
- return IsLoaded();
-}
-
-void wxDynamicLibrary::Unload()
-{
- if( IsLoaded() )
- {
-#if defined(__WXPM__) || defined(__EMX__)
- DosFreeModule( m_handle );
-#elif defined(HAVE_DLOPEN)
- dlclose( m_handle );
-#elif defined(HAVE_SHL_LOAD)
- shl_unload( m_handle );
-#elif defined(__WINDOWS__)
- ::FreeLibrary( m_handle );
-#elif defined(__WXMAC__)
- CloseConnection( &m_handle );
-#else
-#error "runtime shared lib support not implemented"
-#endif
- m_handle = 0;
- }
-}
-
-void *wxDynamicLibrary::GetSymbol(const wxString &name, bool *success) const
-{
- wxCHECK_MSG( IsLoaded(), NULL,
- _T("Can't load symbol from unloaded library") );
-
- 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 );
-#endif
- if( FindSymbol( dllHandle, symName, &symAddress, &symClass ) == noErr )
- symbol = (void *)symAddress;
-
-#elif defined(__WXPM__) || defined(__EMX__)
- DosQueryProcAddr( m_handle, 1L, name.c_str(), (PFN*)symbol );
-
-#elif defined(HAVE_DLOPEN)
- symbol = dlsym( m_handle, name.c_str() );
-
-#elif defined(HAVE_SHL_LOAD)
- if( shl_findsym( &m_handle, name.c_str(), TYPE_UNDEFINED, &symbol ) != 0 )
- symbol = 0;
-
-#elif defined(__DARWIN__)
- if( NSIsSymbolNameDefined( name.c_str() ) )
- symbol = NSAddressOfSymbol( NSLookupAndBindSymbol( name.c_str() ) );
-
-#elif defined(__WINDOWS__)
- symbol = (void*) ::GetProcAddress( m_handle, name.mb_str() );
-
-#else
-#error "runtime shared lib support not implemented"
-#endif
-
- if ( !symbol )
- {
- wxString msg(_("wxDynamicLibrary failed to GetSymbol '%s'"));
-#if defined(HAVE_DLERROR) && !defined(__EMX__)
- const wxChar *err = dlerror();
- if( err )
- {
- failed = TRUE;
- wxLogError( msg, err );
- }
-#else
- failed = TRUE;
- wxLogSysError(_("Couldn't find symbol '%s' in a dynamic library"),
- name.c_str());
-#endif
- }
- if( success )
- *success = !failed;
-
- return symbol;
-}
-
-
-// ---------------------------------------------------------------------------
-// wxPluginLibrary
-// ---------------------------------------------------------------------------