C++/D interface: exceptions

Andrei Alexandrescu via Digitalmars-d digitalmars-d at puremagic.com
Thu Sep 11 17:35:25 PDT 2014


Hello,


We are racking our brains to figure out what to do about exceptions 
thrown from C++ functions into D code that calls them.

A few levels of Nirvana would go like this:

0. Undefined behavior - the only advantage to this is we're there 
already with no work :o).

1. C++ exceptions may be caught only by C++ code on the call stack; D 
code does the stack unwinding appropriately (dtors, scope statements) 
but can't catch stuff.

2. D code can catch exceptions from C++ (e.g. via a CppException wrapper 
class) and give some info on them, e.g. the what() string if any.

Making any progress on this is likely to be hard work, so any idea that 
structures and simplifies the design space would be welcome.


Andrei


More information about the Digitalmars-d mailing list