[Vala] Mapping unnamed nested structs from C lib to Vala



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.
Is there a better way?

Regards



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