C++/D interface: exceptions

Sean Kelly via Digitalmars-d digitalmars-d at puremagic.com
Fri Sep 12 15:40:12 PDT 2014


On Friday, 12 September 2014 at 16:11:28 UTC, Marco Leise wrote:
> Am Fri, 12 Sep 2014 15:55:37 +0000
> schrieb "Sean Kelly" <sean at invisibleduck.org>:
>
>> On Friday, 12 September 2014 at 06:56:29 UTC, Jacob Carlborg 
>> wrote:
>> > On 64bit Objective-C can catch C++ exceptions. But I don't 
>> > think you can do anything with the exception, i.e. it uses 
>> > the following catch syntax:
>> >
>> > @catch(...) {}
>> >
>> > Would that be easier?
>> 
>> I think the trick is setting up the stack frame in such a way 
>> that the C++ exception mechanism knows there's a catch block 
>> available at all.  From there, we should be able to use the 
>> standard interface-to-class method to call virtual functions 
>> on the exception object, and hopefully the C++ runtime will 
>> handle cleanup for us.
>
> What exception object?
>
> throw "bad things happened";

Shouldn't matter.  It's just a callback taking a different
parameter type.  Though I think it would be a fair limitation to
say that D will only catch objects.


More information about the Digitalmars-d mailing list