C++/D interface: exceptions
Jacob Carlborg via Digitalmars-d
digitalmars-d at puremagic.com
Thu Sep 11 23:51:51 PDT 2014
On 12/09/14 02:35, Andrei Alexandrescu wrote:
> 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.
1 and 2 would really be a help for the D/Objective-C integration as well
since on 64bit is uses the same exception model as C++.
--
/Jacob Carlborg
More information about the Digitalmars-d
mailing list