Binding for a function receiving a C callback without arguments
- From: Emmanuel Rodriguez <emmanuel rodriguez gmail com>
- To: "gtk-perl-list gnome org List" <gtk-perl-list gnome org>
- Subject: Binding for a function receiving a C callback without arguments
- Date: Mon, 4 May 2009 17:58:12 +0200
Hi,
I need to write the bindings for a C function that receives a callback which has to arguments. Here's the C declaration:
typedef ChamplainMapSource * (*ChamplainMapSourceConstructor) ();
#define CHAMPLAIN_MAP_SOURCE_CONSTRUCTOR (f) ((ChamplainMapSourceConstructor) (f))
gboolean champlain_map_source_factory_register (ChamplainMapSourceFactory *factory,
ÂÂÂ const gchar *id,
ÂÂÂ ChamplainMapSourceConstructor callback);
I've been reading the perldoc of GClosure.xs (
http://search.cpan.org/~tsch/Glib-1.221/GClosure.xs) and I've peeked a ClutterEffect.xs which has also some closures and tried to implement this by my self but I'm stock. From what I understand the magic of GPerlCallback requires that the C callback accepts a gpointer data. At least, this is how all examples that I've seen so far are doing it. Since my C callback has no argumetns I don't see how I can get it to work. Furthermore the library that I'm binding doesn't have a method that lets me register the C callback with a (GDestroyNotify) so even if I succeed I will be leaking some memory. Note that this isn't so critical as the fuction that I try to bind registers a global factory method which should persist forever unitil the program finishes.
Someome knows of an exisinting C API that has a similar callback and how I can overcome this?
--
Emmanuel Rodriguez
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]