[Vala] extern function prototype gets rearranged



Hi!
I've encountered a weird bug/feature which is breaking everything.

Here's a simple testcase:

namespace Test {

public extern struct Value {
        void *ptr;

        public extern unowned GLib.Date get_date ();
}

int main(string args[]) {
        Test.Value v = Test.Value();
        Date new_date = v.get_date();

        assert (new_date.valid());

        return 0;
}

}

compile this, and you'll see test_value_get_date() is declared in the
C code like this:

void test_value_get_date (TestValue *self, GDate* result);

However, it's extern for a reason, and the C function prototype is to
return a GDate *, not ... whatever this function is doing.

I'm happy to file a bug and look into it myself, but I am not at all
familiar with the vala tree so any advice as to what might be causing
the problem and where to start debugging would be appreciated. My
first guess is that it's some transformation Vala applies to internal
functions in certain cases, but accidentally applies to extern
functions as well .. but I have no real idea.

Thanks for your help!
Sam



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]