Re: [Vala] Vapi help..
- From: Jan Hudec <bulb ucw cz>
- To: Shawn Ferris <shawn ferris gmail com>
- Cc: Vala List <vala-list gnome org>
- Subject: Re: [Vala] Vapi help..
- Date: Sat, 24 Oct 2009 13:20:24 +0200
On Fri, Oct 23, 2009 at 09:59:06 -0600, Shawn Ferris wrote:
Hi All --
I've been trying to troubleshoot a problem with the libgda vapi and I just
can't figure out where it's coming from.. decided it was time to ask. I'm
sure this is something stupid, but I can't find it.
The vapi has this:
public GLib.Value get_value_at (int col, int row) throws GLib.Error;
Which looks good according to the header from libgda. But the generated c
is:
GValue _tmp10_;
GValue _tmp9_ = {0};
_tmp10_ = (gda_data_model_get_value_at (self->res, 1, 1, &_tmp9_,
&_inner_error_), _tmp9_);
The problem is that &_tmp9_ is being injected into the arguments and I can't
figure out how to prevent it. gda_data_model_get_value_at should return the
value rather then set it through a pointer.
Hm, gda_data_model_get_value_at's signature is evil.
GValue is normally passed by reference and for that reason it is not
a [SimpleType]. That however means Vala assumes it's returned by reference
too. All GValue-returning functions in glib, gdk and gtk do it that way.
I don't know whether there is any [CCode(...)] attribute to force pass or
return by value.
In fact I think returning it by value is not legal. The type-dependent setter
is free to store it in any way it wants, which could teoretically include
doing it in a location-dependent fashion, which would make copying the memory
in other way than via g_value_copy incorrect.
The code generated by vala is not valid either, since the assignment from
_tmp9_ to _tmp10_ is not valid for precisely the same reason.
--
Jan 'Bulb' Hudec <bulb ucw cz>
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]