<div class="gmail_quote">On 14 April 2012 22:51, Walter Bright <span dir="ltr"><<a href="mailto:newshound2@digitalmars.com">newshound2@digitalmars.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div class="im">On 4/14/2012 3:49 AM, Manu wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
I have a D DLL, loaded into a C app, if D throws, C doesn't seem to be able to<br>
catch it and it just crashes without any useful messages. Maybe I'm doing it wrong?<br>
</blockquote>
<br></div>
C has no exception handlers in it. C knows nothing about exceptions.<br>
<br>
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.<br></blockquote><div><br></div><div>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.</div>
</div>