[fpc-pascal] SEH
Bernd Kreuss
prof7bit at googlemail.com
Sun Sep 5 23:00:50 CEST 2010
Hi,
I was bored and I played around with SEH exceptions. It might be useful
in some cases when you can't catch an exception in a dll but there might
also be easier methods in some cases. I though before the code will be
forgotten and deleted again I post it here:
the unit seh.pas contains the handler. This handler is very simple, it
will handle all exceptions and always restore the stack to the state it
was when the handler was installed and use the address that was pushed
to the stack to continue execution.
the file sehtest.pas uses this unit and sets up a try/except construct
with two asm blocks and some labels and then triggers an exception
somewhere deeper in the callstack (to test the proper restoring of the
stack). If FPC had more flexible macros then it could be made a bit
nicer but it fulfills its purpose.
Bernd
-------------- next part --------------
A non-text attachment was scrubbed...
Name: seh.pas
Type: text/x-pascal
Size: 3219 bytes
Desc: not available
URL: <http://lists.freepascal.org/pipermail/fpc-pascal/attachments/20100905/7f267fa3/attachment.pas>
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: sehtest.lpr
URL: <http://lists.freepascal.org/pipermail/fpc-pascal/attachments/20100905/7f267fa3/attachment.ksh>
More information about the fpc-pascal
mailing list