Re: How is the type converted
- From: Emmanuele Bassi <ebassi gmail com>
- To: gtk-perl-list gnome org
- Subject: Re: How is the type converted
- Date: Wed, 22 Aug 2007 10:28:48 +0100
On Wed, 2007-08-22 at 12:15 +0800, Ye Wenbin wrote:
Hi,
I'am reading the XS source code of the Gtk2. But I'm confuse about the
type convertion between Perl object and GObject.
you should probably read:
http://gtk2-perl.sourceforge.net/doc/pod/Glib/devel.html
http://gtk2-perl.sourceforge.net/doc/pod/Glib/xsapi.html
http://gtk2-perl.sourceforge.net/doc/binding_howto.pod.html
and the new-gtk2-perl.html document in the project's CVS:
http://gtk2-perl.cvs.sourceforge.net/gtk2-perl/gtk2-perl-xs/new-gtk2-perl.html
I found the typemap file in Gtk2/build/gtk2perl.typemap, all
widget point is using T_GPERL_GENERIC_WRAPPER, which declared in
Glib/typemap. According to the INPUT and OUTPUT section,
GtkWidget will use SvGtkWidget and newSVGtkWidget to convert. The
function is declared in Gtk2/build/gtk2perl-autogen.h which
called gperl_get_object_check and gtk2perl_new_gtkobject. But I
can find where are gperl_get_object_check and
gtk2perl_new_gtkobject defined. I checked all .c files in Gtk2
and Glib, but seem there are no files define them.
they are defined in the Glib module, as they are the basic blocks for
building bindings for GObject-based libraries. look at Glib/GObject.xs
and Glib/GType.xs.
By the way, I wonder why the object create by Gtk2::Window->new contain
an empty hash, but the function in c can find the pointer of the window.
it's using magic - very literally:
Is it because of the PERL_MAGIC_ext?
yep, that's the magic pointer.
the documentation I linked holds more information: you should probably
read it, and use the mailing list's archives to integrate it.
ciao,
Emmanuele
--
Emmanuele Bassi,
W: http://www.emmanuelebassi.net
B: http://log.emmanuelebassi.net
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]