#include #ifdef cpPlugins_SYS_WINDOWS # include #else // cpPlugins_SYS_WINDOWS # include #endif // cpPlugins_SYS_WINDOWS // ------------------------------------------------------------------------- void* cpPlugins::OS::DLLManager:: Load( const std::string& fname, std::string& error ) { void* hnd = NULL; #ifdef cpPlugins_SYS_WINDOWS hnd = ::LoadLibraryA( fname.c_str( ) ); #else // cpPlugins_SYS_WINDOWS hnd = dlopen( fname.c_str( ), RTLD_LAZY | RTLD_GLOBAL ); if( hnd == NULL ) error = dlerror( ); else dlerror( ); #endif // cpPlugins_SYS_WINDOWS return( hnd ); } // ------------------------------------------------------------------------- void cpPlugins::OS::DLLManager:: UnLoad( void* hnd ) { #ifdef cpPlugins_SYS_WINDOWS ::FreeLibrary( ( HMODULE )hnd ); #else // cpPlugins_SYS_WINDOWS dlclose( hnd ); #endif // cpPlugins_SYS_WINDOWS } // ------------------------------------------------------------------------- void* cpPlugins::OS::DLLManager:: GetFunctionHandle( void* hnd, const std::string& function ) { void* f = NULL; if( hnd != NULL ) { #ifdef cpPlugins_SYS_WINDOWS f = ::GetProcAddress( ( HMODULE )hnd, function.c_str( ) ); #else // cpPlugins_SYS_WINDOWS f = dlsym( hnd, function.c_str( ) ); #endif // cpPlugins_SYS_WINDOWS } // fi return( f ); } // eof - $RCSfile$