[Vala] Delegating problem
- From: Mikael Hermansson <mike tielie gmail com>
- To: Vala ML <vala-list gnome org>
- Subject: [Vala] Delegating problem
- Date: Sat, 08 Mar 2008 23:50:06 +0100
Hmm not 100% sure it vala or my code... but below valacode does not
generate valid C code:
--- The vala code ---------------
public delegate void test(int a);
public struct Callbacks
{
public int data;
public weak test cb;
Callbacks(int i, weak test t) { cb = t; data=i;}
}
public class Test : Object {
Callbacks[] cbs;
construct {
cbs=new Callbacks[]
{
new Callbacks(100, foo),
new Callbacks(101, bar)
};
}
void foo(int t)
{
stdout.printf("foo\n");
}
void bar(int t)
{
stdout.printf("bar\n");
}
}
if I make the callbaks static it will work but its not a good solution
in my app...
C output fails with:
error: request for member ‘te_target’ in something not a structure or
union reason is this:
--- The generated CCode ------
static void callbacks_init (Callbacks *self, gint i, test t, void*
t_target) {
test _tmp0;
memset (self, 0, sizeof (Callbacks));
(*self).te = (_tmp0 = t, self.te_target = t_target, _tmp0);
(*self).data = i;
}
it should generate be (*self).te_target = t_target right?
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]