An old thread about the same problem:
https://forum.dlang.org/thread/mmxwhdypncaeikknl...@forum.dlang.org
struct jmp_buf {
byte[256] data;
}
jmp_buf my_jmp_buf;
extern(C) {
int setjmp(ref jmp_buf env);
void longjmp(ref jmp_buf env, int);
}
void
second() {
writefln("second");
// calling 'longjmp' results in a crash with '-m64'
// it works with '-m32mscoff'
longjmp(my_jmp_buf, 1);
}
void
first() {
second();
writefln("first");
}
void
main() {
if (setjmp(my_jmp_buf)) {
writefln("we longjmp-ed to here");
}
else {
first();
}
}
I also want to use '-betterC' (exceptions won't work).