On Thu, Feb 23, 2012 at 09:18:22PM +0100, Artur Skawina wrote: > On 02/23/12 20:58, H. S. Teoh wrote: [...] > > This is a bit off-topic, but what happens in the current > > implementation if you pass a D callback to a C function, and then > > throw an exception from the callback? Does it work? Or does it do > > something really nasty? > > No, unless you consider a segfault to be really nasty. :)
Well, segfaults are nasty, but there are nastier things. :) > Actually, it mostly works - i just tried it in a gtk app, and it works > as long as you catch the exception and only look at the error msg. If > you don't catch it (or try writeln(e) etc), then the result is > something like: > > action.Action!(int).Action.registerNS.MissingActionEx@action.d(54): Action > "GUI" missing symbol 'int AppWindowClosed()' > ---------------- > ./gtkapp() [0x8054366] > /usr/lib/i686/sse2/libgtk-x11-2.0.so.0(+0x153052) [0xf7375052] > /usr/lib/i686/sse2/libgobject-2.0.so.0(g_closure_invoke+0x19b) [0xf71e25fd] > /usr/lib/i686/sse2/libgobject-2.0.so.0(+0x1ddc8) [0xf71f2dc8] > /usr/lib/i686/sse2/libgobject-2.0.so.0(g_signal_emit_valist+0x59a) > [0xf71fa37f] > /usr/lib/i686/sse2/libgobject-2.0.so.0(g_signal_emit+0x34) [0xf71fa61f] > /usr/lib/i686/sse2/libgtk-x11-2.0.so.0(+0x2a17f3) [0xf74c37f3] > /usr/lib/i686/sse2/libgtk-x11-2.0.so.0(gtk_main_do_event+0x8e6) [0xf7373856] > Segmentation fault > > So something appears to get confused while walking the stack; another > thing to investigate later, i guess... [...] Looks like it got confused at the cross-language boundary. T -- Prosperity breeds contempt, and poverty breeds consent. -- Suck.com