@node The Bindings Generator, The GNU General Public License, CORBA, Top
@chapter The Bindings Generator

The @code{(gnome gobject defs-support)} module defines a function,
@code{load-defs}, that creates an environment to natively
@emph{evaluate} the @code{.defs} files. The defined types and
functions are then wrapped by g-wrap.

As an example, Atk is wrapped with the following code, from
@code{gnome/gtk/gw-atk-spec.scm}:

@example
;; wrap atk

;; this wrapper-generation-spec module will actually be installed, along
;; with the defs, so that other wrappers which use Atk types (such as
;; Gtk) can have them available
(define-module (gnome gtk gw-atk-spec)
  :use-module (g-wrap)
  ;; support for GObject, GValue, GType; in turn, this module uses
  ;; gw-glib-spec, which wraps gint, gint32, and the like...
  :use-module (gnome gobject gw-gobject-spec)
  ;; this module provides `load-defs'
  :use-module (gnome gobject defs-support))

;; we use the newest development g-wrap to do the work for us.
(let ((ws (gw:new-wrapset "guile-gnome-gw-atk")))

  (gw:wrapset-set-guile-module! ws '(gnome gtk gw-atk))

  ;; make the types from the following wrapsets available to us...
  (gw:wrapset-depends-on ws "guile-gnome-gw-standard")
  (gw:wrapset-depends-on ws "guile-gnome-gw-glib")
  (gw:wrapset-depends-on ws "guile-gnome-gw-gobject")

  ;; add some headers to the generated c file...
  (gw:wrapset-add-cs-declarations!
   ws
   (lambda (wrapset client-wrapset)
     (if (eq? client-wrapset wrapset)
         '()
         (list
          "#include &lt;atk/atk.h&gt;\n"
          "#include &lt;atk/atk-enum-types.h&gt;\n"))))

  ;; manually wrap AtkState as a 64 bit int
  (register-type "guile-gnome-gw-atk" "AtkState" '&lt;gw:long-long&gt;)

  ;; then we're finished :-)
  (load-defs ws "atk.defs"))
@end example

See @code{gnome/gtk/Makefile.am} to see how the wrapper is actually
produced. More examples can be found within the distribution and in the
@code{gst-guile} project.

That's it for the docs. They're not quite adequate -- want to write some
more? <a href="../../../contact/">Contact us</a>!
