[Vala] Variable sized structs and vapi files
- From: Jan-Jaap van der Geer <jjvdgeer inbox com>
- To: vala-list gnome org
- Subject: [Vala] Variable sized structs and vapi files
- Date: Tue, 15 Sep 2009 00:09:25 +0200
I wonder how to "vapify" a struct that has a variable part at the
end, such as the wimp_menu below (somewhat simplyfied):
struct wimp_menu_entry
{ wimp_menu_flags menu_flags;
wimp_menu *sub_menu;
};
#define wimp_MENU_MEMBERS \
int width; \
int height;
struct wimp_menu
{ wimp_MENU_MEMBERS
wimp_menu_entry entries [UNKNOWN];
};
UNKNOWN is defined to be 1, but the intended structure can be any
length, dependent on what is apropriate. It is actually recommended
to use a macro for defining the structure:
#define wimp_MENU(N) \
struct \
{ wimp_MENU_MEMBERS \
wimp_menu_entry entries [N]; \
}
I wonder how to do this. Somehow Vala needs to know how to allocate
and free the memory for these structures, so I suppose it somehow
needs to be told - but I do not know how.
Any ideas?
Related: Is there documentation about this? If so where can I find
that?
Cheers,
Jan-Jaap
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]