]> Creatis software - cpPlugins.git/blobdiff - lib/cpPlugins/OS/DLLManager.cxx
Windows compilation 3/3
[cpPlugins.git] / lib / cpPlugins / OS / DLLManager.cxx
index ab3cf56d2e742f67b51a186b3eba612d3f932651..727ba18786d834a81acf0e4e941e051ada1204ca 100644 (file)
@@ -12,7 +12,12 @@ 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 )