[Vala] Preprocessing directives in glib-2.0.vapi



Hello 
In glib-2.0.vapi the binding for a GMappedFile looks like this:

[Compact]
#if GLIB_2_22
  [CCode (ref_function = "g_mapped_file_ref", unref_function =
"g_mapped_file_unref")]
#else
  [CCode (free_function = "g_mapped_file_free")]
#endif
  public class MappedFile {
    public MappedFile (string filename, bool writable) throws FileError;
    public size_t get_length ();
    public unowned char* get_contents ();
  }

The new unref_function is for glib versions higher than 2.22 (according
to documentation). I have 2.28.

Is the developer supposed to give the condition GLIB_2_22 himself? Or is
the vala compiler supposed to do that?
At least I can say that it is now only working correctly, if I add the
-D GLIB_2_22 to the compiler args myself.

Is this a bug or not a bug?
If not, is this documented somewhere?

Regards




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