Article: D Exceptions and C Callbacks
Marco Leise
Marco.Leise at gmx.de
Thu Aug 8 18:53:15 PDT 2013
Am Thu, 08 Aug 2013 11:33:28 -0700
schrieb Walter Bright <newshound2 at digitalmars.com>:
> 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.
Just for completeness: In a recent discussion on IRC I learned
that vendor specific attributes exist for C compilers to mark
functions as "ok to use with exceptions".
--
Marco
More information about the Digitalmars-d-announce
mailing list