Re: [Vala] self-less delegates



Hi Steve,

On Sun, 2008-05-25 at 17:12 -0400, Stephen Sinclair wrote:
In any case, in trying to learn the ins and outs of vapi, I ran into a
problem with delegates.  The C library in question uses a registration
function,

class_new(char* name, void* (*)(void) new_method);

So, you register your class and register your new_method function for
that class as a callback.  The library then instantiates your class
whenever it wants.

Anyways, The new_method function does not take any parameters.
However, in trying to use "delegate" to create this callback, I found
that it always seems to add an argument, gpointer *self.  This makes
some sense for most callbacks, but in this case the callback does not
take any parameters.

Use the `static' modifier when declaring the delegate, this prevents the
generation of the user_data / target_object parameter.

Jürg
-- 
Jürg Billeter <j bitron ch>




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