Re: [Vala] Newbie need help



valac -> compiler(ok)
vala -> interpreter ???? what/how/usage

As others said before, /usr/bin/vala is a command for using in Vala
scripts. It compiles the embedded script code on the fly to a temporary
binary and runs it afterwards.

Additionally, I'm using tcc (Ubuntu: sudo apt install tcc) instead of
the default gcc, because it compiles much faster (at the cost of
bigger/slower binary, but scripts are usually not that large).

Minimal Gtk example script (using tcc):

#!/usr/bin/vala --Xcc=-w --cc=tcc --pkg=gtk+-3.0
using Gtk;
int main(string[] args)
{
        Gtk.init (ref args);
        var window = new Window ();
        window.destroy.connect (Gtk.main_quit);
        window.show_all ();
        Gtk.main ();
        return 0;
}

Save it into a file and use something like "sudo chmod a+x" on it and
you may call it afterwards directly as a script.








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