1 #include <cpPlugins/OS/DLLManager.h>
2 #ifdef cpExtensions_OS_Windows
3 #else // cpExtensions_OS_Windows
5 #endif // cpExtensions_OS_Windows
7 // -------------------------------------------------------------------------
8 void* cpPlugins::OS::DLLManager::
9 Open( const std::string& filename )
12 #ifdef cpExtensions_OS_Windows
13 #else // cpExtensions_OS_Windows
14 hnd = dlopen( filename.c_str( ), RTLD_NOW | RTLD_GLOBAL );
15 char* error = dlerror( );
17 throw std::runtime_error( error );
18 #endif // cpExtensions_OS_Windows
22 // -------------------------------------------------------------------------
23 void cpPlugins::OS::DLLManager::
26 #ifdef cpExtensions_OS_Windows
27 #else // cpExtensions_OS_Windows
28 /* TODO: why this clashes with VTK? -> Unregistering of factories.
32 #endif // cpExtensions_OS_Windows
35 // -------------------------------------------------------------------------
36 void* cpPlugins::OS::DLLManager::
37 Sym( void* hnd, const std::string& symbol )
40 #ifdef cpExtensions_OS_Windows
41 #else // cpExtensions_OS_Windows
42 sym = dlsym( hnd, symbol.c_str( ) );
43 char* error = dlerror( );
45 throw std::runtime_error( error );
46 #endif // cpExtensions_OS_Windows