Problems binding a struct that's not a GObject
- From: Emmanuel Rodriguez <emmanuel rodriguez gmail com>
- To: "gtk-perl-list gnome org" <gtk-perl-list gnome org>
- Subject: Problems binding a struct that's not a GObject
- Date: Thu, 23 Apr 2009 10:09:31 +0200
Hi,
I'm writing the bindings for libunique (
http://live.gnome.org/LibUnique) so far everything works fine except for the marshaling of the struct "UniqueMessageData". This type is a normal struct and not a GObject documented as follows:
 typedef struct _UniqueMessageData UniqueMessageData;
I added a typemap file to the project with the following lines:
 TYPEMAP
Â
 UniqueMessageData* T_GPERL_GENERIC_WRAPPER
 UniqueMessageData_ornull* T_GPERL_GENERIC_WRAPPER
And created newSVUniqueMessageData() and SvUniqueMessageData() in the corresponding XS file. The idea is to convert the struct into a perl hash and vice-versa.
So far the XS module compiles and can be loaded, but when I run the example application (from 2 different shells):
shell1$ perl -Mblib examples/sample.pl "Hello world"
shell2$ perl -Mblib examples/sample.pl "It works"
I get in the first shell:
GType UniqueMessageData (138666312) is not registered with gperl at examples/sample.pl line 40.
This bug only happens if I connect the signal 'message-received' and if the main application receives a message. If the signal handler is not connected and a message is sent there will be no crash. This leads me to suppose that the marshaling of the struct UniqueMessageData to a Perl hash ref is not done properly. I seem to know what's the issue but I don't know how to fix it.
The module is hosted here:Â
http://github.com/potyl/gtk2-unique/tree/master--
Emmanuel Rodriguez
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]