[Vala] Question about GHashTable-style foreach
- From: "W. Michael Petullo" <mike flyn org>
- To: vala-list gnome org
- Subject: [Vala] Question about GHashTable-style foreach
- Date: Thu, 9 Dec 2010 11:35:14 -0600
I am having trouble with Vala and a GHashTable-style foreach. I have
created a Vala API for my library, which defines an interface with a
GHashTable-style foreach method. Vapigen / my Vala API file defines
this as:
public abstract void @foreach(GLib.HFunc func, void *data)
When I define a method in Vala as follows, I end up with an extra argument
in the generated C source:
public void @foreach (GLib.HFunc func, void *data) {...}
generates:
static void class_real_foreach (DMAPDb* base, GHFunc func,
void* func_target, void* data) {...}
and fails to compile (note the two "user_data" parameters: func_target
and data).
When I remove the "void *data" from the Vala code (and Vala API file),
everything compiles fine. However, the generated C code contains calls
such as the following:
dmap_db_foreach ((DMAPDb*) self->priv->db,
(GHFunc) dpap_viewer_render_record, NULL);
So, the parameter passed as "user_data" is NULL. But, I need to pass
something. What am I doing wrong?
--
Mike
:wq
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]