This page has been deprecated, see
|
Guidelines for adding gobject-introspection support to libraries
From http://blogs.gnome.org/racarr/2009/06/07/making-your-library-introspectable/
"If you are looking for an example of how to do this, Clutter is a very good one I think. Essentially you first need introspection.m4, and then GOBJECT_INTROSPECTION_CHECK([0.6.3]) in configure.ac. Then, to the appropriate Makefile.am, you need to add the actual calls to the scanner and the compiler. See libclutter’s Makefile.am (around line 248). In most cases it will actually be a little simpler than it is in Clutter."
Rough Guide to g-ir-scanner arguments
The following, at the moment, is a very rough guide based on limited and rough experience, not fact...
As you can see by looking through the patches to add introspection support to libchamplain, gnome-games (and part two), and clutter-gtk (this one is particularly smooth), there are quite a handful of arguments to g-ir-scanner that one needs to worry about when setting up GIR generation:
--namespace <packagename>
The output namespace; say, Clutter, Champlain, GtkClutter; should always be CamelCased
--nsversion=<api version>
- Provide the version number of your api; this allows consumers of the introspection data to request a particular version of side-by-side libraries.
--strip-prefix=<prefix>
Removes a particular prefix from the beginning of C function names in the case where the prefix is not the same as your namespace name; this is true in the case of GLib, for example, where the prefix is g
--include=<included gir>
Another GIR that needs to be included in order to resolve types while scanning; for example, Clutter needs to include Pango-1.0, because it uses various Pango types. Don't forget the version numbers!
--pkg <pkgconfig package>
A pkg-config descriptor for a package that is necessary in order to find other headers that this library depends on. Say, for Clutter, again, pango
--library=<library name>
The library name that we're currently scanning sources for; this needs to be loadable so that GTypes can be determined. For clutter-gtk, this would be, well, clutter-gtk-0.9, just like when passing the -l argument to gcc.
--c-include=<header.h>
- Includes a particular header file in all scanned files; not usually necessary.