Salome HOME
IMP SWP12334
[modules/kernel.git] / src / Utils / Utils_ExceptHandlers.hxx
index 55558245e2f54d05cc8eb988553421d2fd9811d8..8d9077cfdcf031a9bacc6bdcde7733e9d027efb4 100644 (file)
 #ifndef Utils_ExceptHandlers_HeaderFile
 #define Utils_ExceptHandlers_HeaderFile
 
+#include <SALOME_Utils.hxx>
+
 #include <stdexcept>
-#include <utilities.h>
 
 typedef void (*PVF)();
 
-class Unexpect { //save / retrieve unexpected exceptions treatment
+class UTILS_EXPORT Unexpect { //save / retrieve unexpected exceptions treatment
   PVF old;
   public :
+#ifndef WNT
+    Unexpect( PVF f ) 
+      { old = std::set_unexpected(f); }
+  ~Unexpect() { std::set_unexpected(old); }
+#else
     Unexpect( PVF f ) 
-      { old = set_unexpected(f); }
-  ~Unexpect() { set_unexpected(old); }
+      { old = ::set_unexpected(f); }
+  ~Unexpect() { ::set_unexpected(old); }
+#endif
 };
 
-class Terminate {//save / retrieve terminate function
+class UTILS_EXPORT Terminate {//save / retrieve terminate function
   
   PVF old;
   public :
+#ifndef WNT
     Terminate( PVF f ) 
-      { old = set_terminate(f); }
-  ~Terminate() { set_terminate(old); }
+      { old = std::set_terminate(f); }
+  ~Terminate() { std::set_terminate(old); }
+#else
+    Terminate( PVF f ) 
+      { old = ::set_terminate(f); }
+  ~Terminate() { ::set_terminate(old); }
+#endif
 };
 
 #define UNEXPECT_CATCH(FuncName, ExceptionConstructor) \
-void FuncName () {\
+inline void FuncName () {\
    throw ExceptionConstructor (); \
 }
 //Example of the usage 
@@ -70,6 +83,7 @@ void FuncName () {\
 
 
 //Definitions :
-extern void SalomeException();
-extern void SALOME_SalomeException();
+UTILS_EXPORT extern void SalomeException();
+UTILS_EXPORT extern void SALOME_SalomeException();
+
 #endif