Skip to content

Commit 088b875

Browse files
committed
Fix mingw64 exception handling crashes (#16).
1 parent 83e9460 commit 088b875

File tree

2 files changed

+12
-0
lines changed

2 files changed

+12
-0
lines changed

pure/printer.cc

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,12 @@
3232
#undef longjmp
3333
#define setjmp _setjmp
3434
#define longjmp _longjmp
35+
#elif defined(__MINGW64__)
36+
// setjmp/longjmp crash with mingw64, use gcc builtins instead
37+
#undef setjmp
38+
#undef longjmp
39+
#define setjmp __builtin_setjmp
40+
#define longjmp __builtin_longjmp
3541
#endif
3642

3743
#include "gsl_structs.h"

pure/runtime.cc

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,12 @@ typedef std::complex<double> Complex;
8383
#undef longjmp
8484
#define setjmp _setjmp
8585
#define longjmp _longjmp
86+
#elif defined(__MINGW64__)
87+
// setjmp/longjmp crash with mingw64, use gcc builtins instead
88+
#undef setjmp
89+
#undef longjmp
90+
#define setjmp __builtin_setjmp
91+
#define longjmp __builtin_longjmp
8692
#endif
8793

8894
/* Implement the basic GSL-like operations on the matrix types that we need.

0 commit comments

Comments
 (0)