1 #include <cpPlugins/OS/DLLManager.h>
3 #ifdef cpPlugins_OS_Windows
5 #else // cpPlugins_OS_Windows
7 #endif // cpPlugins_OS_Windows
9 // -------------------------------------------------------------------------
10 void* cpPlugins::OS::DLLManager::
11 Load( const std::string& fname, std::string& error )
14 #ifdef cpPlugins_OS_Windows
15 hnd = ::LoadLibraryA( fname.c_str( ) );
16 #else // cpPlugins_OS_Windows
17 hnd = dlopen( fname.c_str( ), RTLD_LAZY | RTLD_GLOBAL );
22 #endif // cpPlugins_OS_Windows
26 // -------------------------------------------------------------------------
27 void cpPlugins::OS::DLLManager::
30 #ifdef cpPlugins_OS_Windows
31 ::FreeLibrary( ( HMODULE )hnd );
32 #else // cpPlugins_OS_Windows
34 #endif // cpPlugins_OS_Windows
37 // -------------------------------------------------------------------------
38 void* cpPlugins::OS::DLLManager::
39 GetFunctionHandle( void* hnd, const std::string& function )
44 #ifdef cpPlugins_OS_Windows
45 f = ::GetProcAddress( ( HMODULE )hnd, function.c_str( ) );
46 #else // cpPlugins_OS_Windows
47 f = dlsym( hnd, function.c_str( ) );
48 #endif // cpPlugins_OS_Windows