Re: [Vala] Using Vala under syscall
- From: "Matías De la Puente" <mfpuente ar gmail com>
- To: "kamel derouiche" <kamelderouiche yahoo com>
- Cc: Vala-list gnome org
- Subject: Re: [Vala] Using Vala under syscall
- Date: Tue, 8 Jul 2008 11:31:17 -0300
Kamel:
You can write vapi files with the structures, functions and constants of every header file.
Here is a little example:
io.vapi:
[[CCode (lower_case_cprefix ="", cheader_filename="sys/io.h")
namespace Io
{
public static int ioperm (ulong from, ulong num, bool turn_on);
public static uchar inb (ushort port);
}
Then use the vapi file with this source:
using GLib;
using Io;
public class Sample : GLib.Object
{
public static void main (string[] args)
{
ioperm (0x0378, 0x0380, true);
uchar a = inb (0x0379);
print ("%d", a);
}
}
Compile the code with:
valac sample.vala --pkg io --vapidir .
I hope that this will be helpful
Matias
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]