[Vala] vala gnome integration



It often troubles me how tightly vala is bound to glib.

Of course this isn't a fault, as such, because vala is designed for writing glib applications - but I want to use it for writing samba modules and kernel modules which don't (and won't) use glib.

Right now I have a fake glib.h which defines many glib items to be normal.

Clearly some of the defines below e.g. g_slice_new0 becomes talloc_zero are specific to me; but I think I would rather vala either: 1. generated more generic calls like: vala_alloc0 and such like, having a macro file to convert these for glib
or
2. used different target definitions so that a generated c file might make use of different primitives according to the target chosen when the vala file was compiled; and include another base header file instead of glib.h

Below are the definitions I'm using on vala 0.4x to compile a samba module.

#define G_END_DECLS
#define gint int
#define gboolean bool
#define gpointer void*
#define FALSE false
#define TRUE true
#define g_slice_new0(A) talloc_zero(NULL,A)
#define g_slice_free(A,V) talloc_free(V)
#define g_return_if_fail(expr)
#define g_return_val_if_fail(expr,value)
#define g_type_class_peek_parent(x) NULL

// for structs that can't have a free_function yet
#define g_free(x) talloc_unref(x)





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