[Vala] passing string length in VAPI file



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)
raster rastersoft com              http://www.rastersoft.com



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]