[Vala] Creating executables without glib/gobject



Matías De la Puente,
I am very interested in what you have done, with your "Multiboot"
code. I'm wondering how far this can be pushed. Is it feasible to code
in a subset of Vala/Genie such that Glib/Gobject is not required, only
the C library, so the executable could be compiled statically with
dietlibc?

For example, this program (in Genie syntax):

init
        print "Hello world"
        var s="1234"
        var i = s.to_int()
        print "string=%s int=%d", s,i

If I add to your 'glib.h' like this:

#define G_BEGIN_DECLS
#define G_END_DECLS
#define g_return_if_fail(T)
#define g_type_init()

#define gint            int
#define gulong          unsigned long
#define gboolean        char
#define gchar           char

#define TRUE    1
#define FALSE   0

#define g_print printf
#define g_strdup strdup
#define g_free free

Then I compile it:

valac demo.gs -C
gcc demo.c -o demo -I.
or statically:
diet gcc -nostdinc demo.c -o demo -I.

I'm wondering though, would I quickly run into trouble if I started to
write anything more than the most elementary Vala/Genie program?

Regards,
Barry Kauler



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