Hello,
I am quite new to Vala. I have ported it to RISC OS but for it to
be of any use I want it to talk to a library called OSLib.
Just to get me started, I tried to create a vapi file for a very
common struct for errors, but I am having difficulties and I
haven't found any relevant documentation about generating vapi
files.
The struct is simply defined as:
struct os_error
{ bits errnum;
char errmess [252];
};
My vapi file looks like this:
[CCode (cheader_filename = "oslib/os.h")]
namespace OSLib
{
[CCode (cname = "os_error")]
public struct OSError
{
public int errnum;
public char[252] errmess;
}
}
And a very simple program to use it:
using GLib;
using OSLib;
public class Test : Object
{
public static void main(string[] args)
{
OSError osError = OSError();
osError.errnum = 4;
}
}
The C program that is generated by Vala (0.7.2 in case that
matters) looks like this:
void test_main (char** args, int args_length1) {
os_error _tmp0_ = {0};
os_error osError;
osError = (memset (&_tmp0_, 0, sizeof (os_error)), _tmp0_);
osError.errnum = 4;
os_lib_os_error_destroy (&osError);
}
Of course, this last method does not exist, so it does not compile.
What am I doing wrong?
Cheers,
Jan-Jaap
_______________________________________________
Vala-list mailing list
[email protected]
http://mail.gnome.org/mailman/listinfo/vala-list