[Vala] Fwd: Define constant at compile time






Begin forwarded message:

From: pancake <pancake youterm com>
Date: November 16, 2010 8:28:38 PM GMT+01:00
To: Aleksander Wabik <alex wabik gmail com>
Subject: Re: [Vala] Define constant at compile time


Use -D

Using this in source just opens the door to weird design problems. It's a design decission, not a bug

Else you just have to use const string which translates into a define

On Nov 16, 2010, at 6:42 PM, Aleksander Wabik <alex wabik gmail com> wrote:

Hi all,

I'm new to Vala and I'd like to have some help to solve a small but
frustrating problem. Basically, I have a Gtk.UIManager that I want to
initialize in this way:

var ui_manager = new Gtk.UIManager();
ui_manager.add_ui_from_file(UI_FILE);

I want to specify the constant UI_FILE at compile time, but I don't know
how to do that. In C I would write something like that:

#ifndef UI_FILE
#define UI_FILE "default-path.xml"
#endif

and then I would call gcc with the option -DUI_FILE="something". I've tried to use the -D option of the Vala compiler, but it doesn't seem to
work as I expect. Any ideas?

Many thanks,
Andrea


AFAIK it's not possible, and my humble request would be to consider
developing vala preprocessor into something useful. I want to use it
too ;)

best regards,

--
Mój klucz publiczny o identyfikatorze 1024D/E12C5A4C znajduje się na
serwerze hkp://keys.gnupg.net

My public key with signature 1024D/E12C5A4C is on the server
hkp://keys.gnupg.net
_______________________________________________
vala-list mailing list
vala-list gnome org
http://mail.gnome.org/mailman/listinfo/vala-list


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