Thanks!

I was missing the `const' qualifier. As const variables
need not to be put inside methods, i need to add static variables
or global ones to handle the arguments :(

Anyway, why in OptionContext's method :

public bool parse (out string[] argv) throws OptionError;

argv is out? Shouldn't it be a ref?

++

Vlad a écrit :
> Émilien Tlapale wrote:
>> Hi,
>> I am trying to use the command line parsing interface
>> from GLib in Vala but got some problems.
>>
>> The first is that I just don't know how to create
>> an array of GLib.OptionEntry to be given to
>> GLib.OptionContext.add_main_entries(). Since
>> OptionEntry is a `struct' I can create them one by
>> one using `new OptionEntry{field=value, ...}' and
>> add them to an array, but maybe there is an easier
>> way of doing it?
>>
>> The second point is that OptionEntry defines a
>> field called `flags_' in glib-2.0.vapi and C code
>> accessing to this `flags_' field is generated but
>> the C library defines only a `flags' field.
>>
>> Thanks a lot for this very nice Vala project!
>>
>>   --
>> Émilien Tlapale
>>   
> You can initialize an (array of) structs like this:
>    const OptionEntry[] options = {
>        { "op1", 0, 0, OptionArg.STRING, out op1_variable, "op1 
> description", "op1 short description.." },
>        { "op2", 0, 0, OptionArg.STRING, out op2_variable, "op2 
> description", "op2 short description.." },
>        { null }
>    };
>
_______________________________________________
Vala-list mailing list
[email protected]
http://mail.gnome.org/mailman/listinfo/vala-list

Reply via email to