Any libunwind experts n da house?
Iain Buclaw via Digitalmars-d
digitalmars-d at puremagic.com
Sat Sep 27 15:59:06 PDT 2014
On 27 Sep 2014 21:35, "IgorStepanov via Digitalmars-d" <
digitalmars-d at puremagic.com> wrote:
>
> On Saturday, 27 September 2014 at 20:11:34 UTC, Iain Buclaw via
Digitalmars-d wrote:
>>
>> 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.
>
>
> Is this way acceptable for D, or not. Why?
In the EH routines, we should be able to make do with a generic
CppException and pass it back to a D catch. What won't work too well is
catching a specific C++ exception.
Iain.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.puremagic.com/pipermail/digitalmars-d/attachments/20140927/c776cf93/attachment.html>
More information about the Digitalmars-d
mailing list