[Dlang-internal] Dlang structured exception handling on Windows

KytoDragon kytodragon at e.mail.de
Mon Mar 19 18:39:30 UTC 2018


I currently have a problem i don't know how to fix:

Programms compiled in D (either compiler) have the annoying 
property that they absorb all windows seh-exceptions, print the 
error code and terminate the process.

For example, the following programm will print "Program exited 
with code -1073741819" and exit:

module test.Test;

void main() {
     *cast(int*)cast(void*)0 = 1;
}

But what I expected was the following:

https://imgur.com/LH8gUtt (translated for your language)

The problem with this is, that this "feature" somehow even 
manages to catch windows fail-fast exceptions, which are supossed 
to bypass all exception handling (and debuggers!) and go directly 
to WER (Windows Error Reporting). This makes it impossible to 
debug these types of exceptions, as D nearly silently swallows 
them. My questions are now:

What exactly causes this behaviour? (e.q. which part of 
druntime/phobos/dmd/ldc2)
Is there a way to disable that?
Has anybody an other solution?


More information about the Dlang-internal mailing list