Re: [Vala] CCode array length field name

On Mon, 2009-11-30 at 15:09 -0800, Evan Nemerson wrote:
On Mon, 2009-11-30 at 23:45 +0100, pHilipp Zabel wrote:

[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.

IIRC this should do the trick:

[CCode (cname == "os_error")]
public struct error {
  public unowned int errnum;
  public unowned char errmess[252];

Great, this indeed works. The position of the [] in both versions
confuse me, though.

If errmess is null-terminated and utf-8 encoded, you could wrap it as
a weak string.

Why weak?

I agree, binding it as a string is likely the right way to go. 

The string not necessarily 0-terminated (although the vast majority will
be) and latin1 encoded (though the vast majority will be ASCII only).

Thanks for your help.


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