Re: BetterC + Windows + setjmp longjmp

2019-05-22 Thread kinke via Digitalmars-d-learn
On Wednesday, 22 May 2019 at 16:37:36 UTC, Lobachevsky wrote: I have been experimenting with setjmp / longjmp under Windows as a way to break out of an endless loop. With my experiments, longjmp appears to silently exit the process, no stack trace, nothing. Black emptiness. I don't think

Re: BetterC + Windows + setjmp longjmp

2019-05-22 Thread Lobachevsky via Digitalmars-d-learn
I have been experimenting with setjmp / longjmp under Windows as a way to break out of an endless loop. With my experiments, longjmp appears to silently exit the process, no stack trace, nothing. Black emptiness. I stared with the C program described in https://docs.microsoft.com/en-us

Re: BetterC + Windows + setjmp longjmp

2018-09-20 Thread Diederik de Groot via Digitalmars-d-learn
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

Re: BetterC + Windows + setjmp longjmp

2018-09-20 Thread SrMordred via Digitalmars-d-learn
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

Re: BetterC + Windows + setjmp longjmp

2018-09-19 Thread SrMordred via Digitalmars-d-learn
Note: setjmp/longjmp should only be used in "@system + @nogc + nothrow / -betterC" code. g++ and clang give me sizeof = 256. dmc give me 64. I tried all this sizes and other, but still crashes.

Re: BetterC + Windows + setjmp longjmp

2018-09-19 Thread Diederik de Groot via Digitalmars-d-learn
any windows machines so had to use these references (and could not test anything): - WinSDK10: goo.gl/m9DjZt - MARS: goo.gl/Qoc6g2 Code above does not yet cover the Mars case, but the i386 sizes should be the same. Please Note: setjmp/longjmp should only be used in "@system + @nogc + no

Re: BetterC + Windows + setjmp longjmp

2018-09-19 Thread Diederik de Groot via Digitalmars-d-learn
. 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=-2147217396

Re: BetterC + Windows + setjmp longjmp

2018-09-18 Thread SrMordred via Digitalmars-d-learn
On Tuesday, 18 September 2018 at 20:01:48 UTC, SrMordred wrote: longjmp is crashing so may be related to the struct declaration. Well just found a thread of the same problem, just that in my case with 64x crashes too. https://forum.dlang.org/post/mmxwhdypncaeikknl...@forum.dlang.org

Re: BetterC + Windows + setjmp longjmp

2018-09-18 Thread SrMordred via Digitalmars-d-learn
longjmp is crashing so may be related to the struct declaration.

Re: BetterC + Windows + setjmp longjmp

2018-09-18 Thread SrMordred via Digitalmars-d-learn
On Tuesday, 18 September 2018 at 03:09:18 UTC, Mike Parker wrote: 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

Re: BetterC + Windows + setjmp longjmp

2018-09-17 Thread Mike Parker via Digitalmars-d-learn
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

Re: BetterC + Windows + setjmp longjmp

2018-09-17 Thread Diederik de Groot via Digitalmars-d-learn
) To catch the signal With a handler signature of: enum void function(int) nothrow @nogc @system SIG_ERR; [...] 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

Re: BetterC + Windows + setjmp longjmp

2018-09-17 Thread SrMordred via Digitalmars-d-learn
function(int) nothrow @nogc @system SIG_ERR; [...] 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.

Re: BetterC + Windows + setjmp longjmp

2018-09-17 Thread Diederik de Groot via Digitalmars-d-learn
On Monday, 17 September 2018 at 23:44:41 UTC, SrMordred wrote: Its possible to use setjmp/longjmp on windows? Or, to be straight to my problem: its possible to continue execution after a SIGSEGV(or any other failure/signal) with betterC and windows? You can use core.stdc.signal nothrow @nogc

BetterC + Windows + setjmp longjmp

2018-09-17 Thread SrMordred via Digitalmars-d-learn
Its possible to use setjmp/longjmp on windows? Or, to be straight to my problem: its possible to continue execution after a SIGSEGV(or any other failure/signal) with betterC and windows?

Re: setjmp / longjmp

2015-06-09 Thread Stewart Gordon via Digitalmars-d-learn
On 27/04/2015 10:41, ketmar wrote: snip i believe this has something to do with exception frames. but it needs further investigation. What is an exception frame, exactly? Moreover, are these frames applicable even in sections of code where no throwing or catching of exceptions takes place?

Re: setjmp / longjmp

2015-06-09 Thread ketmar via Digitalmars-d-learn
are unpredictable. tldr; don't use setjmp/longjmp in the language with exceptions, unless you can describe it's runtime internals and exception handling down to assembler code when you're awaken at night completely drunk. ;-) signature.asc Description: PGP signature

Re: setjmp / longjmp

2015-04-27 Thread ketmar via Digitalmars-d-learn
On Sun, 26 Apr 2015 21:45:41 +0100, Stewart Gordon wrote: On 26/04/2015 06:56, ketmar wrote: snip you shouldn't use setjmp/longjmp in D. use exceptions instead. something like this: snip True in the general case. Still, there must be some reason that trying it in D causes an AV (even

Re: setjmp / longjmp

2015-04-26 Thread Cassio Butrico via Digitalmars-d-learn
. estoutentando manupular the setjmp / longjmp buffers , but the error , I use windows 7 and the dmd 2067 , will be whose manipulate the buffers save and return ? Excuse my english sucks. you shouldn't use setjmp/longjmp in D. use exceptions instead. something like this: instead of setjmp: try

Re: setjmp / longjmp

2015-04-26 Thread ketmar via Digitalmars-d-learn
On Sat, 25 Apr 2015 23:25:13 +, Cassio Butrico wrote: Hello everyone , first congratulations for the wonderful forum , I wish someone could help me , I am writing a small basic interpreter in D and I am with some difficulties. estoutentando manupular the setjmp / longjmp buffers

Re: setjmp / longjmp

2015-04-26 Thread Stewart Gordon via Digitalmars-d-learn
On 26/04/2015 06:56, ketmar wrote: snip you shouldn't use setjmp/longjmp in D. use exceptions instead. something like this: snip True in the general case. Still, there must be some reason that trying it in D causes an AV (even if I disable the GC). I remain curious about what that reason

Re: setjmp / longjmp

2015-04-26 Thread Cassio Butrico via Digitalmars-d-learn
I'm just building a small interpreter with a script and wanted to handle errors diverting the flow and returning . I am grateful for having responded my question , thank you.

setjmp / longjmp

2015-04-25 Thread Cassio Butrico via Digitalmars-d-learn
Hello everyone , first congratulations for the wonderful forum , I wish someone could help me , I am writing a small basic interpreter in D and I am with some difficulties. estoutentando manupular the setjmp / longjmp buffers , but the error , I use windows 7 and the dmd 2067 , will be whose