X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;f=lib%2FcpPlugins%2FOS%2FDLLManager.cxx;fp=lib%2FcpPlugins%2FOS%2FDLLManager.cxx;h=0000000000000000000000000000000000000000;hb=410a1d0bf36fb01148880c034973308e4600ffda;hp=727ba18786d834a81acf0e4e941e051ada1204ca;hpb=f1747c7248d5eead5ea9d7e57bda0b081bcef065;p=cpPlugins.git diff --git a/lib/cpPlugins/OS/DLLManager.cxx b/lib/cpPlugins/OS/DLLManager.cxx deleted file mode 100644 index 727ba18..0000000 --- a/lib/cpPlugins/OS/DLLManager.cxx +++ /dev/null @@ -1,58 +0,0 @@ -#include - -#ifdef cpPlugins_OS_Windows -# include -#else // cpPlugins_OS_Windows -# include -#endif // cpPlugins_OS_Windows - -// ------------------------------------------------------------------------- -void* cpPlugins::OS::DLLManager:: -Load( const std::string& fname, std::string& error ) -{ - void* hnd = NULL; -#ifdef cpPlugins_OS_Windows - UINT old = ::SetErrorMode( SEM_FAILCRITICALERRORS ); - ::SetErrorMode( old | SEM_FAILCRITICALERRORS ); - hnd = ::LoadLibraryA( fname.c_str( ) ); - ::SetErrorMode( old ); - if( hnd == NULL ) - error = "Could not load library."; -#else // cpPlugins_OS_Windows - hnd = dlopen( fname.c_str( ), RTLD_LAZY | RTLD_GLOBAL ); - if( hnd == NULL ) - error = dlerror( ); - else - dlerror( ); -#endif // cpPlugins_OS_Windows - return( hnd ); -} - -// ------------------------------------------------------------------------- -void cpPlugins::OS::DLLManager:: -UnLoad( void* hnd ) -{ -#ifdef cpPlugins_OS_Windows - ::FreeLibrary( ( HMODULE )hnd ); -#else // cpPlugins_OS_Windows - dlclose( hnd ); -#endif // cpPlugins_OS_Windows -} - -// ------------------------------------------------------------------------- -void* cpPlugins::OS::DLLManager:: -GetFunctionHandle( void* hnd, const std::string& function ) -{ - void* f = NULL; - if( hnd != NULL ) - { -#ifdef cpPlugins_OS_Windows - f = ::GetProcAddress( ( HMODULE )hnd, function.c_str( ) ); -#else // cpPlugins_OS_Windows - f = dlsym( hnd, function.c_str( ) ); -#endif // cpPlugins_OS_Windows - } // fi - return( f ); -} - -// eof - $RCSfile$