[Issue 16029] New: D exception aborts program when called from C++

via Digitalmars-d-bugs digitalmars-d-bugs at puremagic.com
Mon May 16 03:33:56 PDT 2016


          Issue ID: 16029
           Summary: D exception aborts program when called from C++
           Product: D
           Version: D2
          Hardware: x86_64
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P1
         Component: druntime
          Assignee: nobody at puremagic.com
          Reporter: david.feurle at sodgeit.de

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() {
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


More information about the Digitalmars-d-bugs mailing list