Questions about GClosure

Juan Rafael GarcĂ­a Blanco <[email protected]> Sun, 7 Apr 2013 11:04:14 +0200
Newsgroups gmane.comp.gnome.devel
Message-ID <[email protected]>
Hello everybody,

I've a few questions about how closures should be used. I'm writing a GLib wrapper for OpenCL, and I feel the need to use callbacks. I'll try to explain what I don't understand about closures.

g_cclosure_new takes a pointer to user data as argument. This is passed to the callback in its last argument. But then, when I call g_closure_invoke() I need to pass a GValue array containing the arguments to the callback, and I guess user_data is included here. I see this as a redundant action, so my guess is I've got something wrong. I hope you can clarify this a little bit for me. I'll appreciate it.

Thank you very much in advance.

Regards,
Juan.