summaryrefslogtreecommitdiff
path: root/rts/Excn.h
diff options
context:
space:
mode:
Diffstat (limited to 'rts/Excn.h')
-rw-r--r--rts/Excn.h34
1 files changed, 34 insertions, 0 deletions
diff --git a/rts/Excn.h b/rts/Excn.h
new file mode 100644
index 0000000000..b393234021
--- /dev/null
+++ b/rts/Excn.h
@@ -0,0 +1,34 @@
+/* -----------------------------------------------------------------------------
+*
+* (c) The GHC Team 1998-2000
+*
+* Hides indirection for EH handlers for different platforms
+*
+* ---------------------------------------------------------------------------*/
+
+#ifndef EXCN_H
+#define EXCN_H
+
+#include "ghcconfig.h"
+
+// On windows Excn provides two macros
+// BEGIN_WINDOWS_VEH_HANDLER and END_WINDOWS_VEH_HANDLER, which
+// will catch such exceptions in the entire process and die by
+// printing a message and calling stg_exit(1).
+//
+// For other operating systems an empty macro is defined so
+// that no #ifdefs are needed around the usage of these macros.
+
+
+#if defined(mingw32_HOST_OS)
+#include "win32/veh_excn.h"
+
+#define BEGIN_WINDOWS_VEH_HANDLER __register_hs_exception_handler();
+#define END_WINDOWS_VEH_HANDLER __unregister_hs_exception_handler();
+#else
+#define BEGIN_WINDOWS_VEH_HANDLER
+#define END_WINDOWS_VEH_HANDLER
+#endif /* mingw32_HOST_OS */
+
+#endif /* EXCN_H */
+