Wrapped types are instances of the
<gw-type> class and hold
information about a C type being wrapped and how to wrap it. In
See G-Wrap's High-level API, you will see examples of sub-classes
<gw-type> dedicated to wrapping certain C types, such as
pointers, integers, strings, etc.
Besides C code generation methods, a number of methods apply to all
<gw-type>. Code generation methods are described
separately, in section See G-Wrap's Code Generation API.
Return a symbol denoting the Scheme name for wrapped type type.
On success, return a string that represents some default C value for
"NULL" if type is a pointer type).
This is useful, for instance, to generate C code where no variable is
left uninitialized. If no default C value is known for type,
#f is returned.
Wrapped C types in G-Wrap are broadly separated into two classes: those for which information is available at run-time, and those for which this is not the case. Run-time type information (or RTTI, or RTI, whichever you prefer) allows G-Wrap’s support run-time libraries to manipulate C objects whose type they only know at run-time. In particular, this allows those libraries to construct C function calls at run-time, instead of letting generated code do this (see Wrapped Functions).
Wrapped types for which information is available at run-time are
represented by the
<gw-rti-type> class (a sub-class of
<gw-type>), defined in
(g-wrap rti). Actually, most of
the C types wrapped by G-Wrap’s standard wrapset (see C Types Provided in the Standard Wrapset) are sub-classes of this class.
Ranged integers, wrapped C pointers (see Wrapping a C Pointer Type), strings, are RTI types. Even user-defined so-called
simple types (see see Wrapping Another Simple C Type)
<gw-rti-type>: all the user needs to do is pass
the appropriate run-time type specification, via the
A number of additional methods are defined for instances of
Return a string representing the name of the C type wrapped by type.
Return a string representing the
const-qualified version of the
C type wrapped by type.
Return a symbol denoting run-time type information for the C type wrapped by type. This symbol corresponds to a type tag understandable by libffi (see Wrapping Another Simple C Type).
Return a string denoting the name of the C function that wraps, unwraps, or destroys instances of the C type wrapped by type (see See Wrapping Another Simple C Type, for details).