std library hooks

Manu turkeyman at gmail.com
Sat Apr 14 16:41:03 PDT 2012


On 14 April 2012 22:51, Walter Bright <newshound2 at digitalmars.com> wrote:

> On 4/14/2012 3:49 AM, Manu wrote:
>
>> I have a D DLL, loaded into a C app, if D throws, C doesn't seem to be
>> able to
>> catch it and it just crashes without any useful messages. Maybe I'm doing
>> it wrong?
>>
>
> C has no exception handlers in it. C knows nothing about exceptions.
>
> I recommend that all your APIs in a D DLL be wrapped in something that
> catches all exceptions, and then does something recognizable to the calling
> C code.
>

I mean to say C++, are the exceptions compatible? I don't think it's
feasible for me to wrap the top level of every function implemented in D in
a try/catch statement. I suppose I'll just have to make use of a 'weak
assert' in our code, where it may be possible to continue. I suppose
library asserts will make the assumption they can absolutely not continue,
so as long as I can hook a message first, the proceeding crash is fine.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.puremagic.com/pipermail/digitalmars-d/attachments/20120415/295aef4f/attachment-0001.html>


More information about the Digitalmars-d mailing list