BetterC + Windows + setjmp longjmp

Mike Parker aldacron at gmail.com
Tue Sep 18 03:09:18 UTC 2018


On Tuesday, 18 September 2018 at 00:24:23 UTC, SrMordred wrote:

> Yes, i'm using signal(SIGSEGV, sigfn_t func), it catches 
> correctly, but end the execution after.
>
> I find the alternatives of setjmp/longjmp and sigaction, but 
> none are avaliable on windows afaik.

setjmp/longjmp are available on windows (image loaders using 
libpng, lua, quake3, and lots of old C code make use of them):

https://msdn.microsoft.com/en-us/library/xe7acxfb.aspx?f=255&MSPPError=-2147217396
https://msdn.microsoft.com/en-us/library/3ye15wsy.aspx

You can declare the functions in your own code and they should 
link just fine. It would be helpful if you also submit a PR to 
add them to DRuntime for Windows.

As for sigaction, a quick search suggests it isn't available (and 
it doesn't show up in MSDN):

https://stackoverflow.com/questions/32389905/sigaction-and-porting-linux-code-to-windows


More information about the Digitalmars-d-learn mailing list