Re: Problems binding a struct that's not a GObject





On Thu, Apr 23, 2009 at 1:59 PM, Torsten Schoenfeld <kaffeetisch gmx de> wrote:
Emmanuel Rodriguez wrote:
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;

It appears to be registered as a GBoxed type, though. ÂThat means you can put it in your 'maps' file and get the conversion stuff auto-generated for you. ÂAnd since UniqueMessageData seems to be opaque intentionally, the default GBoxed representation chosen by Glib::Boxed (opaque scalar reference) seems fine and you shouldn't need custom converters.
I added to the maps file the conversion mapping for UniqueMessageData as a GBoxed and it works better, at least it doesn't crash. Now I have strange bug where the main window simply disapears (gets closed) when I receive a message, but this is another issue.
Â


I get in the first shell:
GType UniqueMessageData (138666312) is not registered with gperl at
examples/sample.pl line 40.

This happens because a signal apparently uses UniqueMessageData in its signature, so the generic signal marshaller in Glib complains that this type hasn't been registered with the bindings. ÂIf you put UniqueMessageData in your 'maps' file, this should just work.
Yes the signal that I bind receives an UniqueMessageData in the arguments. This is why I was suspecting that Glib was able to convert the UniqueMessageData struct into a valid perl object.


--
Emmanuel Rodriguez


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