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