Toward GIR ? #27

vmagnin opened this Issue May 23, 2011 · 0 comments


None yet

1 participant

vmagnin commented May 23, 2011

Currently, we use regular expressions to parse the C header files of the libraries (see and GIR files could be an alternative. This is opened to discussion.

I have begun playing with the ElementTree module in python to parse the GIR files that can be found in /usr/share/gir-1.0/ :

Atk-1.0.gir        GdkPixbuf-2.0.gir  Gtk-3.0.gir         PangoXft-1.0.gir
Epiphany-2.29.gir  GdkX11-2.0.gir     Pango-1.0.gir       Unity-3.0.gir
Gdk-2.0.gir        GdkX11-3.0.gir     PangoCairo-1.0.gir
Gdk-3.0.gir        Gtk-2.0.gir        PangoFT2-1.0.gir

These GIR files are XML files that describe the functions, structures, constants, etc. that are in these libraries (see

For other libraries like GLib, you may generate the GIR file using the .typelib file in /usr/gir/girepository-1.0 (you need the gobject-introspection package):

g-ir-generate /usr/lib/girepository-1.0/GLib-2.0.typelib > glib.xml

But in that case, there is no "c:identifier" attribute in the tag (how to identify a pointer ?)


  • parsing XML is easier than using regular expressions which must take into account many exceptions and peculiarities.
  • The binding would be more complete (to what extent ?).


  • GIR format is not well documented.
  • Cairo is not (yet ?) supported. So would still be necessary at least for it. Probably also for others like GLib (see the "c:identifier" problem above).
  • We would lose the C prototypes in comments and also in gtk-fortran-index.csv
  • A new effort.

The question is: is it worth while ? Or would it be more adequate to improve ?

See also on the gtk-sharp binding. After installing the gobject-introspection package under Ubuntu, we have the python file /usr/lib/gobject-introspection/giscanner/ which we could perhaps use to parse the gir files.

@vmagnin vmagnin was assigned May 23, 2011
@vmagnin vmagnin closed this Dec 7, 2011
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment