Jürg Billeter <j <at> bitron.ch> writes:

> I understand the issue. Unfortunately, it's not easy to solve. One issue
> is that you might need multiple #if in the generated code for a single
> #if in the Vala code - e.g. for #include directives. It would also
> require the Vala compiler to support dealing with multiple declarations
> of the same method for different conditions, which would make semantic
> and flow analysis a lot more difficult.
> 
> I'd be happy to hear proposals how we could solve this in a
> non-intrusive way.
> 
> Jürg
> 

May be static if or something like that?

void my_method () {
    [StaticIf]
    if (vala.pkg.gtk+-2.0.version > 2.4.0") {
        // Use new gtk+
    } else {
        // Use legacy gtk+
    }
}

Version can be simply get from pkg-config.

Regards


_______________________________________________
Vala-list mailing list
Vala-list@gnome.org
http://mail.gnome.org/mailman/listinfo/vala-list

Reply via email to