Re: [Vala] Vala arrays and libraries bindings
- From: Andrea Del Signore <sejerpz tin it>
- To: Дмитрий Петров <dpetroff gmail com>
- Cc: vala-list gnome org
- Subject: Re: [Vala] Vala arrays and libraries bindings
- Date: Thu, 31 May 2012 21:06:44 +0200
Hi,
On Mon, 2012-05-28 at 03:30 +0400, Дмитрий Петров wrote:
Hello everyone,
I'm very new to vala and my current task is to build an application
using webkit-gtk component. One thing that I can't deal with is
how valac translates the arrays, that should be passed to the function.
May be you have already solved the issue, anyway you can control where
vala puts the array length parameter using a CCode attribute [1].
In this specific case you should bind the JSObjectMakeArray in this way:
[CCode (cname = "JSObjectMakeArray")]
public Object.array (
Context ctx,
[CCode(array_length_type="size_t", array_length_pos=1.1)] JSCore.Value[] arguments,
out JSCore.Value exception);
And then use in your code in this way (NOTE: I omitted the array length
parameter since vala do that work for us)
...
return new JSCore.Object.array( ctx, dirs, out err);
}
HTH,
Andrea
[1] https://live.gnome.org/Vala/Manual/Attributes
[
Date Prev][Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]