[Vala] Constructors in VAPI
- From: Marco Trevisan (Treviño) <mail 3v1n0 net>
- To: vala-list gnome org
- Subject: [Vala] Constructors in VAPI
- Date: Tue, 22 Sep 2009 06:57:29 +0200
Hello, I've to define a constructor for a kind of "virtual class" that
I'm defining in a VAPI.
Practically I've some functions which can be applied to an int pointer,
but I don't have a constructor (and I don't want to edit the C code),
nor I want the developer to see that an int pointer is used as base.
Until Vala 0.7.5 I was able to do this by using this workaround(?):
[Compact]
[CCode (cname = "gint", free_function = "g_free")]
public class MyVirtualClass {
public void method1();
...
public void methodN();
}
With this I was able to create a new MyVirtualClass, in fact Vala used
g_new to create a new int pointer to which apply my methods, and I was
able to define functions wich returned a MyVirtualClass object (an int*,
btw).
With Vala 0.7.6 I can't any more define a such class, since I'm asked
for a constructor, and if I add an empty one I get a linking error since
vala tries to use the invalid C function prefix_my_virtual_class_new()
as constructor, instead of a simple gnew0 for generating the int
pointer.
How can I solve this?
Thanks.
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]