The (gnome gobject defs-support)
module defines a function, load-defs
, that creates an environment to natively evaluate the .defs
files. The defined types and functions are then wrapped by g-wrap.
As an example, Atk is wrapped with the following code, from gnome/gtk/gw-atk-spec.scm
:
;; 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 <atk/atk.h>\n" "#include <atk/atk-enum-types.h>\n")))) ;; manually wrap AtkState as a 64 bit int (register-type "guile-gnome-gw-atk" "AtkState" '<gw:long-long>) ;; then we're finished :-) (load-defs ws "atk.defs"))
See gnome/gtk/Makefile.am
to see how the wrapper is actually produced. More examples can be found within the distribution and in the 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>!