Re: [Vala] CCode array length field name
- From: pHilipp Zabel <philipp zabel gmail com>
- To: Jan-Jaap van der Geer <jjvdgeer inbox com>
- Cc: vala-list gnome org
- Subject: Re: [Vala] CCode array length field name
- Date: Mon, 30 Nov 2009 23:45:18 +0100
On Mon, Nov 30, 2009 at 10:19 PM, Jan-Jaap van der Geer
<jjvdgeer inbox com> 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
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]