Bug 16029 – D exception aborts program when called from C++

Status
NEW
Severity
normal
Priority
P3
Component
druntime
Product
D
Version
D2
Platform
x86_64
OS
Linux
Creation time
2016-05-16T10:33:56Z
Last change time
2024-12-07T13:36:35Z
Assigned to
No Owner
Creator
David Feurle
Moved to GitHub: dmd#17152 →

Comments

Comment #0 by david.feurle — 2016-05-16T10:33:56Z
I export a function from d to c++ with extern(C++). The d code has a try catch statement on the highest level.Whenever the d code throws a exception the program aborts. I have c++ objects on the call stack and call the function in d. Then there is the d try catch statement and then the d exception throw. The d code: extern (C++) void ThrowEx() { try { throw new Exception("hello"); } catch (Exception ex) { } } The c++ code: extern "C" int rt_init(); void ThrowEx(); void func() { rt_init(); ThrowEx(); } When I change ThrowEx to not throw an exception everything works as expected. The d code gets executed and no error occurs. When the program crashes the following output is generated: dwarfeh(224) fatal error uncaught exception
Comment #1 by destructionator — 2016-05-23T00:01:31Z
This actually works for me.. what are some other details of your setup?
Comment #2 by robert.schadek — 2024-12-07T13:36:35Z
THIS ISSUE HAS BEEN MOVED TO GITHUB https://github.com/dlang/dmd/issues/17152 DO NOT COMMENT HERE ANYMORE, NOBODY WILL SEE IT, THIS ISSUE HAS BEEN MOVED TO GITHUB