RE: signals versus vfuncs
- From: Murray Cumming Comneon com
- To: christof petig-baender de, scott asofyet org
- Cc: gtk-devel-list gnome org
- Subject: RE: signals versus vfuncs
- Date: Fri, 9 Jan 2004 13:53:16 +0100
> Actually it's something like:
> register a new type for the C++ instance (to enable vfunc
> overriding),
> override every vfunc by a wrapper (static [C like] member functions)
> which calls the virtual member function [with C++ wrapped arguments]
> (which in turn, if not overridden, unwraps the arguments and
> calls the
> original gtk+ functions). This costs some overhead for each
> vfunc call
> (additional indirection). [Actually the gtkmm implementation
> shortcuts
> wrapping/unwrapping and the middle indirection if possible]
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. You can see some of this in Glib::ObjectBase:
http://cvs.gnome.org/lxr/source/glibmm/glib/glibmm/objectbase.cc#150
I see that Christof understands gtkmm internals very well. I'll be sending
relevant patch requests to him in future.
Murray Cumming
www.murrayc.com
murrayc usa net
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]