Throwing D exceptions through C++ call stack

Nicholas Wilson iamthewilsonator at hotmail.com
Wed Feb 21 03:10:09 UTC 2018


On Tuesday, 20 February 2018 at 21:31:03 UTC, Timothee Cour wrote:
> https://github.com/Syniurge/Calypso now allows catch C++ 
> exceptions from D handlers (on OSX and linux at least)
>
>
> On Tue, Feb 20, 2018 at 1:04 PM, H. S. Teoh via Digitalmars-d 
> <digitalmars-d at puremagic.com> wrote:
>> I'm piecewise migrating one of my old C++ projects to D, and 
>> one of the major issues right now is exception handling.
>>
>> What's the state of C++ exception support right now?  Is it 
>> safe for a D function (called from C++ code) to throw an 
>> exception, and have the stack unwind through the C++ call 
>> stack and caught by D code at the bottom of the stack?  Or 
>> will it potentially interact badly with the C++ part of the 
>> call stack?  I'm guessing C++ dtors may not get called, etc.?
>>
>> Conversely, is it safe for C++ code to throw an exception that 
>> unwinds through D functions in the call stack, and caught by a 
>> C++ catch block?
>>
>>
>> T
>>
>> --
>> Elegant or ugly code as well as fine or rude sentences have 
>> something in common: they don't depend on the language. -- 
>> Luca De Vitis

LDC soon too, https://github.com/ldc-developers/ldc/pull/2590


More information about the Digitalmars-d mailing list