Salome HOME
Error messages processing on librarry loading under windows platform
authorsbh <sergey.belash@opencascade.com>
Mon, 2 Mar 2015 10:05:16 +0000 (13:05 +0300)
committersbh <sergey.belash@opencascade.com>
Mon, 2 Mar 2015 10:09:14 +0000 (13:09 +0300)
env_Salome.bat
src/Config/Config_ModuleReader.cpp
src/XGUI/XGUI_Workshop.cpp

index ca536a79758326adca659951c46e9dcb837bdf85..e7e3551a5b9e9a7a2705e18604c464ceef5fc73a 100644 (file)
@@ -89,7 +89,7 @@ IF "%ARCH%" == "Win64" (
 )
 
 @SET NEW_GEOM_CONFIG_FILE=%ROOT_DIR%\install\plugins
-@SET PATH=%ROOT_DIR%\install\plugins;%ROOT_DIR%\install\bin;%PATH%
+@SET PATH=%ROOT_DIR%\install\swig;%ROOT_DIR%\install\plugins;%ROOT_DIR%\install\bin;%PATH%
 @SET PYTHONPATH=%ROOT_DIR%\install\swig;%ROOT_DIR%\install\plugins;%PYTHONPATH%
 
 @SET LightAppConfig=%ROOT_DIR%\install\share\salome\resources\newgeom;%GUI_ROOT_DIR%\share\salome\resources\gui
index 6acffa268d3e46e2ac66c57df2602a93688c271f..2dfd4c135395f8d83c0d82860dae44179e7a9a73 100644 (file)
@@ -184,16 +184,28 @@ void Config_ModuleReader::loadLibrary(const std::string& theLibName)
   if (aFileName.empty())
     return;
 
-#ifdef WIN32
+  #ifdef WIN32
   HINSTANCE aModLib = ::LoadLibrary(aFileName.c_str());
-#else
+  #else
   void* aModLib = dlopen( aFileName.c_str(), RTLD_LAZY | RTLD_GLOBAL );
-#endif
+  #endif
   if(!aModLib && theLibName != "DFBrowser") { // don't show error for internal debugging tool
     std::string anErrorMsg = "Failed to load " + aFileName;
-    #ifndef WIN32
+    #ifdef WIN32
+    DWORD   dwLastError = ::GetLastError();
+    LPSTR messageBuffer = NULL;
+    size_t size = ::FormatMessageA(FORMAT_MESSAGE_ALLOCATE_BUFFER |
+                                 FORMAT_MESSAGE_FROM_SYSTEM | 
+                                 FORMAT_MESSAGE_IGNORE_INSERTS,
+                                 NULL, 
+                                 dwLastError, 
+                                 MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), 
+                                 (LPSTR)&messageBuffer, 0, NULL);
+    anErrorMsg += ": " +  std::string(messageBuffer, size);
+    #else
     anErrorMsg += ": " + std::string(dlerror());
     #endif
+    std::cerr << anErrorMsg << std::endl;
     Events_Error::send(anErrorMsg);
   }
 }
index 52472194c16772346e0fc68dda56463031446ce7..99311b558daec401d533944b8e7841cb295b80a7 100644 (file)
@@ -446,15 +446,13 @@ void XGUI_Workshop::processEvent(const std::shared_ptr<Events_Message>& theMessa
                                aMsg->parameters());
       }
     }
-  }
-
-  
-  else {
+  } else {
     //Show error dialog if error message received.
     std::shared_ptr<Events_Error> anAppError = std::dynamic_pointer_cast<Events_Error>(theMessage);
     if (anAppError) {
       emit errorOccurred(QString::fromLatin1(anAppError->description()));
     }
+    return;
   }
   if (!isSalomeMode()) {
     SessionPtr aMgr = ModelAPI_Session::get();