Thanks, Jonas for the quick response (again)!
Jonas Maebe wrote 10 lines
On 25 Sep 2009, at 18:09, Lukas Zeller wrote:
> The longjmp itself works, but after this has happened once, further
> exceptions crash the program. I wonder if there is some (FPC)
> cleanup routine I could or should call before the longjmp that
> would make the scenario work, or if there is technical evidence
> that it can't work at all.
There is no "technical evidence" that it can't work at all, but you
would have to call internal RTL routines [...]
I hope I read that correctly as: "just longjump can't work and leaves a mess behind that might explain crashes on subsequent exceptions"
Show quoted text 5 lines
[...] which are not for public use, so
a) this is not documented or supported in any way (I can't tell you
the names by heart either)
b) if you manage to figure it out, then your code can break with any
future FPC version
Yes - if it was "my code", I'd try to avoid the situation. It unfortunately isn't, the calling environment only provides that routine which longjmps to handle a exception situation. So making it work with the current FPC version and risking it'll break in a future version would be better than nothing.
Maybe there's a better solution, but what are the official options I have in ExceptProc other than halt? If I just return from it, how does the call flow continue? At that time the stack must be already unwound, but how far? While I understand ExceptProc is called when a exception falls through all the way down to a pascal main program, I can't really imagine at what point the same happens in a pascal shared lib.
Thanks for any explanations!
Lukas