To get started with vala you need the vala-to-c-compiler valac, common development tools and libraries.
Detailed instructions about the needed build tools can be found at the GNOME Development Tools page. And the most recent vala compiler can be obtained from the official vala page. Vala is packaged for all major distributions, e.g it can be installed on Fedora using yum:
$ sudo yum install vala
If all requirements are met, put the lines below into a file named
printargs.vala
:void main (string[] args) { foreach (var arg in args) { print ("Argument: %s\n", arg); } }
As we have got some code now, we need to compile it using valac, the compiler which compiles vala to c and subsequently calls a c-compiler to build an executable.
$ valac printargs.vala $ ./printargs some arguments Argument: ./printargs Argument: some Argument: arguments
If you wonder what C-Code valac generated, call valac with the following switches:
$ valac --save-temps printargs.vala $ cat printargs.c
No comments:
Post a Comment