On Mon, 2015-11-23 at 01:03 +0000, Al Thomas wrote:
> > From: Matrix <pigex.zh...@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.

It might help to copy this graphic from the FAQ:

https://wiki.gnome.org/Projects/Vala/FAQ#What_does_.5BSimpleType.5D_and
_.5BCompact.5D_in_bindings_mean.3F

Attachment: signature.asc
Description: This is a digitally signed message part

_______________________________________________
vala-list mailing list
vala-list@gnome.org
https://mail.gnome.org/mailman/listinfo/vala-list

Reply via email to