Import

G-Golf Import interfaces.
Importing GNOME libraries.

Procedures

gi-import
gi-import-by-name

Description

The G-Golf GIR namespace (Typelib) import interfaces.

Procedures

Procedure: gi-import namespace [#:version #f]

Returns nothing.

Imports the namespace GIR Typelib and exports its interface. For example:

,use (g-golf
(gi-import "Clutter")

The namespace is a case sensitive string. It is an error to call this procedure using an invalid namespace.

The optional #:version keyword argument may be used to require a specific namespace version, otherwise, the latest will be used.

This procedure is certainly one of the first thing you will want to try and use, but it has a cost: you will not ‘feel it’ if the number of objects in namespace is relatively small, but importing the "Gtk" namespace, on a laptop equiped with a i5-2450M CPU  2.50GHz × 4 and 6GB of memory takes nearly 2 seconds.

So, either early in the development cycle, or when your application is more stable, at your best convenience, you may consider making a series of selective import instead, see gi-import-by-name here below.

Procedure: gi-import-by-name namespace name [#:version #f] [#:with-method #t]

Returns the object or constant returned by gi-import-info called upon the GIBaseInfo info named name in namespace.

Obtains and imports the GIBaseInfo info named name in namespace. The namespace and name arguments are case sensitive. It is an error to call this procedure using an invalid namespace or name.

The optional #:version keyword argument may be used to require a specific namespace version, otherwise, the latest will be used.

The optional keyword #:with-method argument - which is #t by default - is passed to the gi-import-enum, gi-import-flags and gi-import-struct. When #:with-method is #f, then the enum, flags or struct info will be imported without their respective methods. This is likely to only be the case if/when you intend to selectively import an enum, flags or struct from GLib or GObject, which is what G-Golf itself does, for example, in the top level (g-golf) module:

(gi-import-by-name "GLib" "IOChannel" #:with-method #f)