[Vala] [SimpleType] public struct Integer : uint {} does not work
- From: Henrik /KaarPoSoft <henrik kaarposoft dk>
- To: vala-list gnome org
- Subject: [Vala] [SimpleType] public struct Integer : uint {} does not work
- Date: Wed, 18 Jan 2012 17:56:44 +0100
Dear all,
I am trying to create a new type in vala,
like "typedef" in C.
http://live.gnome.org/Vala/Tutorial has this example:
/* defining an alias for a basic type (equivalent to typedef int Integer
in C)*/
[SimpleType]
public struct Integer : uint {}
However, it does not seem to work...
I have created the following file called i.vala:
<code>
[SimpleType]
public struct Integer : uint {
}
public static int main (string[] args) {return 0;}
</code>
Compiling with valac i.vala gives:
/home/henrik/v1/i.c: In function ‘integer_get_type’:
/home/henrik/v1/i.c:22:79: error: ‘integer_dup’ undeclared (first use in
this function)
/home/henrik/v1/i.c:22:79: note: each undeclared identifier is reported
only once for each function it appears in
/home/henrik/v1/i.c:22:109: error: ‘integer_free’ undeclared (first use
in this function)
This is running on Linux Mint 12 (like Ubuntu Oneiric)
Vala 0.14.0
gcc (Ubuntu/Linaro 4.6.1-9ubuntu3) 4.6.1
I tried also using latest version of vala from git:
Vala 0.15.0.72-516e7
with the same result.
valac --save-temps shows only this in i.c:
<snip>
GType integer_get_type (void) {
static volatile gsize integer_type_id__volatile = 0;
if (g_once_init_enter (&integer_type_id__volatile)) {
GType integer_type_id;
integer_type_id = g_boxed_type_register_static ("int32_t",
(GBoxedCopyFunc) integer_dup, (GBoxedFreeFunc) integer_free);
g_once_init_leave (&integer_type_id__volatile, integer_type_id);
}
return integer_type_id__volatile;
}
</snip>
So it is obvious that the C compiler barfs,
integer_dup and integer_free are never defined.
Any help on what I am doing wrong here would be most appreciated!
/Henrik
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]