Re: [Vala] help with writting vapi...
- From: Al Thomas <astavale yahoo co uk>
- To: Matrix <pigex zhang gmail com>, "vala-list gnome org" <vala-list gnome org>
- Subject: Re: [Vala] help with writting vapi...
- Date: Mon, 23 Nov 2015 01:03:56 +0000 (UTC)
From: Matrix <pigex zhang gmail com>
Sent: Sunday, 22 November 2015, 8:07
Subject: [Vala] help with writting vapi...
i'm writting hiredis vala's binding..
here is a function like this:
redisContext *redisConnectWithTimeout(const char *ip, int port, const
struct timeval tv);
so, how to tell the valac that the 3rd param is struct value not struct
pointer?
Another useful nugget from the Legacy Bindings document
( https://wiki.gnome.org/Projects/Vala/LegacyBindings#Structs ):
"Very rarely the struct in a C library is used by passing it as a value to functions and not a reference
...[This pattern] should be bound using Vala's SimpleType attribute to override Vala's default behaviour of
passing structs by reference"
So add
[SimpleType]
before your struct in the binding.
If that works then that section of the document makes
more sense if it is under the 'Binding Parameter Types'
section. I'll add a structs sub-section there and move
that paragraph there if it is helpful for others.
Al
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]