Any libunwind experts n da house?
Iain Buclaw via Digitalmars-d
digitalmars-d at puremagic.com
Sat Sep 27 13:11:25 PDT 2014
On 27 September 2014 10:53, Jacob Carlborg via Digitalmars-d
<digitalmars-d at puremagic.com> wrote:
> On 2014-09-23 19:37, Andrei Alexandrescu wrote:
>>
>> We need a libunwind expert to figure out a good approach for handling
>> exceptions thrown by C++ code into D.
>
>
> BTW, are you only interested in handling C++ exception, or are you
> interested in handling D exceptions in C++ as well?
>
> One ugly hack is to register a terminate handler. Then in the handler
> extract the necessary information from the exception, create a D exception
> with this information and throw it as a regular D exception.
>
> Throwing a D exception that should be catchable in C++ is a bit more tricky.
> It's possible to wrap the a call to a D function in a try-catch block.
> Convert the D exception to a C++ exception, then throw it using a function
> part of the C++ exception runtime. The problem here is that C++ won't be
> able to catch this exception because there's no personality function (or
> similar) setup by the D compiler.
>
> Ideally D should just use the same exception mechanism as C++. I don't think
> a language change is necessary for this. Changes in the compiler, yes, but
> hopefully not in the language.
>
Well, ObjC++ shares the same EH personality routines as C++, which
probably accounts for the compatibility. :)
Iain.
More information about the Digitalmars-d
mailing list