Catching OS Exceptions in Windows using LDC

realhet real_het at
Sat Jul 4 12:45:50 UTC 2020


I'd like to catch the OS Exceptions including:

- access violation
- int 3
- invalid opcode

The default behavior is that when these events happen, the 
program immediately exits with some negative exit code.

It was not a problem on other systems like: MSVC or Delphi, but 
on LDC these events are completely ignored.

It would be very useful to catch these errors inside and have the 
opportunity to handle it whatever is the best: application exit, 
save important data, ignore.

I've already found a solution from Adam D. Ruppe, but that's for 
Linux for the Access Violation case. But is there a similar thing 
for Windows as well?

PS: I do believe rely on AccessViolation to avoid buffer overruns 
is really useless and unsecure. But it would be so much help for 
me for developing/debugging my programs.

Thank You!

More information about the Digitalmars-d-learn mailing list