/* test.c generated by valac 0.12.1, the Vala compiler * generated from test.vala, do not modify */ #include #include #include #include #define TYPE_FOO (foo_get_type ()) typedef struct _Foo Foo; struct _Foo { gint data; }; GType foo_get_type (void) G_GNUC_CONST; Foo* foo_dup (const Foo* self); void foo_free (Foo* self); void foo_bar (Foo *self); void _vala_main (void); void foo_bar (Foo *self) { (*self).data = 42; } Foo* foo_dup (const Foo* self) { Foo* dup; dup = g_new0 (Foo, 1); memcpy (dup, self, sizeof (Foo)); return dup; } void foo_free (Foo* self) { g_free (self); } GType foo_get_type (void) { static volatile gsize foo_type_id__volatile = 0; if (g_once_init_enter (&foo_type_id__volatile)) { GType foo_type_id; foo_type_id = g_boxed_type_register_static ("Foo", (GBoxedCopyFunc) foo_dup, (GBoxedFreeFunc) foo_free); g_once_init_leave (&foo_type_id__volatile, foo_type_id); } return foo_type_id__volatile; } void _vala_main (void) { Foo _tmp0_ = {0}; Foo element; Foo* _tmp1_ = NULL; Foo* array; gint array_length1; gint _array_size_; Foo _tmp2_; _tmp0_.data = 0; element = _tmp0_; _tmp1_ = g_new0 (Foo, 100); array = _tmp1_; array_length1 = 100; _array_size_ = 100; foo_bar (&element); _tmp2_ = array[23]; foo_bar (&_tmp2_); fprintf (stdout, "element.data = %d, array[23].data = %d\n", element.data, array[23].data); array = (g_free (array), NULL); } int main (int argc, char ** argv) { g_type_init (); _vala_main (); return 0; }