On Thursday, 20 September 2018 at 12:11:55 UTC, SrMordred wrote:
Ok, after a better look at the sources I finally got it:
setjmp is a macro.
the true function signature is "int _setjmp(jmp_buf, void*)"
the void* is the current function address which in mingw
sources are capture by "__builtin_frame_address(0)".
And I did´t look yet to see if Dlang have an equivalent.
but calling _setjmp(jmp_buf, null); the simple examples are
working :)
Nice to see you managed to figure it all out, congrats!
So it now looks something like this ?:
version(Windows) {
version(X86)
enum _JBLEN = 64;
else version(X86_64)
enum _JBLEN = 256;
else version(IA64)
enum _JBLEN = 528;
alias ubyte[_JBLEN] jmp_buf;
extern (C) {
int _setjmp(ref jmp_buf, null);
void longjmp(ref jmp_buf, int);
}
alias _setjmp setjmp;
}
Hopefully you will be able to merge the two examples and create a
nice druntime PR out of it. The
https://forum.dlang.org/post/mmxwhdypncaeikknl...@forum.dlang.org
version does look a lot cleaner (but also a little more cryptic).
Might be wise to follow the core.sys.posix.setjmp.d
implementation. If available, maybe also add the sigsetjmp /
siglonggmp and sigaction versions (if available on windows).
Good luck !