Article: D Exceptions and C Callbacks

Walter Bright newshound2 at digitalmars.com
Thu Aug 8 11:33:28 PDT 2013


On 8/8/2013 6:48 AM, Marco Leise wrote:
> I recently proposed using nothrow in GtkD as well. This
> article was kind of a coincidence now. Yes, it is a real issue
> with binding to C code unfortunately. Especially on amd64 with
> GCC compiled stuff since it omits the stack frame that DMD
> requires to unwind the stack resulting in immediate crashes
> (druntime HLTs the execution) as soon as you throw an
> exception from a callback.


I agree that C callbacks called from C code should be nothrow.

At a minimum, the C code that calls the callback is not going to be expecting an 
exit via exception, and so may leave things in an indeterminate state.


More information about the Digitalmars-d-announce mailing list