On Mon, Nov 30, 2009 at 10:19 PM, Jan-Jaap van der Geer <[email protected]> wrote: > On Sun, 2009-11-29 at 00:38 +0100, pHilipp Zabel wrote: >> > vapi binding: >> > >> > public class SomeStruct { >> > [CCode (array_param_name?...)] // what should this be ? >> >> [CCode (array_length_name = "dataLength", array_length_type = "size_t")] >> >> Not sure if that should be size_t or gsize. > > I have something related. I have the following struct in C: > > typedef struct > { > int errnum; > char errmess[252]; > } os_error; > > Right now I have this vapified like this: > > [CCode (cname == "os_error")] > public struct error > { > public unowned int errnum; > public unowned char[] errmess; > } > > However, when accessing the error.errmess.length I get compilation > errors (in C,, not in Vala. error: 'os_error' has no member named > 'errmess_length1'). I suppose this is due to a problem in the vapi, but > I am not really sure how to tell Vala the length is 252 bytes. > > I tried prefixing the errmess member with: > [CCode (array_length_name = "252", array_length_type = "int")] > but that did not seem to make a difference. > > Any ideas?
[CCode (array_length = false)] will make Vala turn errmess.length into constant -1 instead of errmess_length1. I don't know of any way to make that constant 252 instead. If errmess is null-terminated and utf-8 encoded, you could wrap it as a weak string. regards Philipp _______________________________________________ Vala-list mailing list [email protected] http://mail.gnome.org/mailman/listinfo/vala-list
