On Sun, 2015-11-22 at 16:07 +0800, Matrix wrote:
> Hi :
> 
> 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?

Unfortunately, this is done on a per-type basis, and virtually everyone
passes struct timeval as a pointer so that's what the bindings assume.
Before seeing this function, I don't know that I've ever seen it passed
as anything but a pointer.

AFAIK the only way to do this would be to create a local binding for
struct timeval (in the redis vapi) with a [SimpleType] annotation on
it, and have redis use that type instead of the one in glib-2.0.

FWIW it might be possible to add an annotation to allow for passing a
non-SimpleType struct as a value.  I don't spend much time in the
compiler, but I believe a small change to
valaccodemethodcallmodule.vala would do the trick.


-Evan

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