[dmd-internals] Relation between D and C++ exception handling on Windows
Don Clugston
dclugston at googlemail.com
Sat Jan 1 11:10:01 PST 2011
Consider this simple program:
----
void main()
{
try {
throw new Exception("xxx");
}
catch (Exception e) {}
}
---
The map file includes these functions:
test0.map: 0002:0000D838 ?__internal_cpp_framehandler@@YA?AW4_EXCEPTION_DI
SPOSITION@@PAUfunc_data@@PAU_EXCEPTION_RECORD@@PAU_CPP_Establisher_Frame@@PAU_CO
NTEXT@@PAX at Z 0040F838
test0.map: 0002:0000D814 __cpp_framehandler 0040F814
test0.map: 0002:0000D814 __cpp_framehandler 0040F814
test0.map: 0002:0000D838 ?__internal_cpp_framehandler@@YA?AW4_EXCEPTION_DI
SPOSITION@@PAUfunc_data@@PAU_EXCEPTION_RECORD@@PAU_CPP_Establisher_Frame@@PAU_CO
NTEXT@@PAX at Z 0040F838
I don't like this at all. Why is the C++ exception handler being
linked into a D program?
This is important, because the C++ exception behaviour is different to D.
I've just spent the best part of a week trying to track down bug 1513
("try/catch/finally misbehavior on windows"), which has turned out to
be the most difficult bug I've ever seen.
I'm finding it extremely difficult since the Microsoft documentation
is practically non-existent, and DMC seems to have a unique
implementation. Now I'm starting to suspect that part of the C++
exception handling mechanism may be involved, which would be bad.
Quick question to Walter -- is it possible that the D exception
handlers are sometimes called from the C++ handler?
More information about the dmd-internals
mailing list