Next: , Previous: Wrapping a C Pointer Type, Up: G-Wrap's High-level API


C Types Provided in the Standard Wrapset

Beside the generic wrapped C pointer type (WCT) and wrapped enumerate type, G-Wrap comes with a standard wrapset that includes a number of commonly used wrappers for C types (see Wrapsets). This wrapset can be made available by using the (g-wrap ws standard) module.

When creating a wrapset that depends on the wrapped types defined in the standard wrapset, make sure you specify standard among the dependencies of you wrapset class as shown in See Wrapsets.

The table below summarizes the wrapped provided by the standard wrapset:

G-Wrap Name C Name Scheme Type


void void unspecified


bool int boolean


char char character


float float inexact number


double double inexact number


size_t size_t exact number


int int exact number


unsigned-int unsigned int exact number


mchars char * string

Similarly, other integer types not listed here are available (e.g., short, unsigned-long-long, etc.), as well as variants with a specified ranged (e.g., int8, unsigned-int32, etc.).

The type mchars denotes strings, i.e., null-terminated character arrays on the C side. Note that mchars alone does not specify any memory ownership semantics. Therefore, when wrapping C functions that manipulate strings, you may in turn specify the memory management semantics that are valid for this functions and the strings it operates on. This is done by adding appropriate type qualifiers to the string argument of the wrapped function, such as caller-owned (see Wrapping a C Function).