Use C++ exception model in D

Dan Olson zans.is.for.cans at yahoo.com
Wed Apr 9 08:52:04 PDT 2014


"David Nadlinger" <code at klickverbot.at> writes:

> On Tuesday, 8 April 2014 at 18:55:35 UTC, Brad Roberts wrote:
>> I think, for a mixed language application, that the important part
>> is proper object lifetime management more than being able to catch
>> exceptions from different languages.  When unwinding a c++ exception
>> that has stack frames intermixed with D, destructors need to be
>> executed appropriately, and vice versa.
>
> I haven't actually tried to do this, but in theory, this should be the
> easy part with libunwind. You just ignore foreign exceptions during
> the search phase (i.e. not catch them), and during the unwind phase,
> your own personality function is called again for cleanup regardless
> of the handler the stack actually unwinds to.

I tried handling foreign exceptions back in Feb with the sjlj
personality function I am using in LDC for iOS.  Well, at least doing
cleanups so that a objc/c++ exception could bubble up and D could call
dtors and finally blocks.  It was mostly working but I wanted to make
progress on other stuff so shelved it since I had normal D sjlj eh
working.
-- 
Dan


More information about the Digitalmars-d mailing list