Libffi
provides a number of built-in type descriptors that can
be used to describe argument and return types:
ffi_type_void
void
. This cannot be used for argument types, only
for return values.
ffi_type_uint8
ffi_type_sint8
ffi_type_uint16
ffi_type_sint16
ffi_type_uint32
ffi_type_sint32
ffi_type_uint64
ffi_type_sint64
ffi_type_float
float
type.
ffi_type_double
double
type.
ffi_type_uchar
unsigned char
type.
ffi_type_schar
signed char
type. (Note that there is not an exact
equivalent to the C char
type in libffi
; ordinarily you
should either use ffi_type_schar
or ffi_type_uchar
depending on whether char
is signed.)
ffi_type_ushort
unsigned short
type.
ffi_type_sshort
short
type.
ffi_type_uint
unsigned int
type.
ffi_type_sint
int
type.
ffi_type_ulong
unsigned long
type.
ffi_type_slong
long
type.
ffi_type_longdouble
long double
type, this is defined.
On other platforms, it is not.
ffi_type_pointer
void *
pointer. You should use this for all
pointers, regardless of their real type.
Each of these is of type ffi_type
, so you must take the address
when passing to ffi_prep_cif
.