On Sat, Jul 14, 2012 at 12:12 AM, foracc <[email protected]> wrote:

> Hey there,
>
> I got an unnamed struct nested in another struct in a C library. Like this:
>
>         typedef struct {
>                 int a;
>
>                 struct {
>                         int x;
>                         int y;
>                 } vals;
>         } mystruct;
>
> How would I map that to Vala? I tried this:
>
>         [Compact]
>         [CCode (cheader_filename="mylib.h", cname="mystruct")]
>         public struct mystruct {
>                 public int a;
>
>                 [CCode (cname="vals.x")]
>                 int x;
>                 [CCode (cname="vals.y")]
>                 int y;
>         }
>
> It works, but isn't faithful to the original C library, and will run into
> problems if the outer struct has equally named fields as the nested struct.
>

Call them vals_x, vals_y.

-- 
www.debian.org - The Universal Operating System
_______________________________________________
vala-list mailing list
[email protected]
https://mail.gnome.org/mailman/listinfo/vala-list

Reply via email to