An intermediate function is the typical way to do it. You can also bind it
as `uint8[]` array and pass `string.data`. If the inner function is marked
`private` it won't appear in the generated ValaDoc. There's lots of this in
`glib-2.0.vapi`.


On 6 December 2013 07:38, rastersoft <[email protected]> wrote:

> Hi all:
>
> I'm completing the XCB api for Vala, but I have a problem: there are
> several functions that receive a string and its length, like:
>
>     xcb_intern_atom (xcb_connection_t *_conn_, uint8_t _only_if_exists_,
> uint16_t _name_len_, const char *_name_);
>
> Currently I'm doing it this way, by defining an intermediate function:
>
>         [CCode (cname = "xcb_intern_atom")]
>         public InternAtomCookie *l_intern_atom(bool only_if_exists,uint16
> len, string name);
>
>         [CCode (cname = "vala_xcb_intern_atom")]
>         public InternAtomCookie *intern_atom(bool only_if_exists,string
> name) {
>             this.l_intern_atom(only_if_exists,(uint16)name.length, name);
>         }
>
> But it's not very elegant. Is there a way of doing this directly in a VAPI
> file?
>
> I tried with array_length_pos, but seems to not work in this case.
>
> Thanks.
>
> --
> Nos leemos
>                          RASTER    (Linux user #228804)
> [email protected]              http://www.rastersoft.com
>
> _______________________________________________
> vala-list mailing list
> [email protected]
> https://mail.gnome.org/mailman/listinfo/vala-list
>



-- 
--Andre Masella<[email protected]>
http://www.masella.name/
_______________________________________________
vala-list mailing list
[email protected]
https://mail.gnome.org/mailman/listinfo/vala-list

Reply via email to