Next: , Up: G-Wrap's High-level API   [Contents][Index]

3.2.1 Wrapping a C Function

As seen in See A Simple Example, wrapping a C function using G-Wrap’s high-level functions is relatively simple. Essentially, it boils down to a call to the wrap-function! GOOPS method.

method: wrap-function! (wrapset <gw-wrapset>) . args

Add the C function described by args to the list of functions to be wrapped by wrapset. The arguments in args must contain the following named parameters (see (ice-9 optargs) in The GNU Guile Reference Manual):


the symbol which should be bound to the wrapped function in Scheme at runtime.


the symbol naming the G-Wrap wrapped type of the C function result.


a string giving the C function’s name.


a list of the C function’s arguments where each element is of the form (more details below).


a string describing the function; this string may contain Texinfo markup.

The argument list which is passed as the #:arguments named parameter consists of a list of argument specifiers. Each argument specifier is itself a two-element list where:

The type specifier may in turn be one of the following:

To illustrate this, here is an example of a valid argument description list (type mchars will be detailed later on, see C Types Provided in the Standard Wrapset):

'(((mchars null-ok caller-owned) input-string)
  (long input-integer)
  ((double out) output-floating-point))

Examples of valid usage patterns of wrap-function! are available in See Creating a Wrapper Module.

Next: , Up: G-Wrap's High-level API   [Contents][Index]