Re: signals versus vfuncs



On Friday, January 9, 2004, at 07:53 AM, Murray Cumming Comneon com wrote:

An important part of this is that we can always get the C++ instance from the C instance. We use quarks with g_object_set_data() to store a pointer to the 1 and only C++ wrapper instance in the C instance. Without that, the overriden C vfunc in gtkmm would not be able to call the C++ instance's method.

we do something very similar in Glib::Object, for the same reasons --- we store a pointer to the wrapper in instance qdata. in fact, we also store the pointer to the C object in "magic" attached to the Perl object, so to Perl developers it looks like a normal blessed hash, in which you can store whatever you want. there's a fancy black-magic hack in which we share reference counts between the Perl and C objects in order to ensure that they go away at the right time, completely removing the burden of reference counting from the Perl developer. it's very nice. ;-)


I see that Christof understands gtkmm internals very well. I'll be sending
relevant patch requests to him in future.

:-D

--
elysse (pregnant): are your hands cold?
me: uh, i suppose so.
elysse: will you put them on me?




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]