Module compiler

ffi::types

Each tag stands for one C type. Pass a tuple of tags for the arguments and one tag for the return type to declare.

Built into the compiler.

Import what you use (use path::* is not allowed):

use ffi::types::{Int, Float};

Types#

NameDescription
IntFFI tag for a 64-bit signed integer (int64_t), passed from and returned as int.
FloatFFI tag for a 64-bit float (double), passed from and returned as float.
StringFFI tag for a NUL-terminated C string (const char *), passed from and returned as string.
VoidFFI tag for no value (void), valid only as a return type.
BoolFFI tag for a C bool (one byte, 0 or 1), passed from and returned as bool.
Int8FFI tag for an 8-bit signed integer (int8_t), passed from and returned as int.
Int16FFI tag for a 16-bit signed integer (int16_t), passed from and returned as int.
Int32FFI tag for a 32-bit signed integer (int32_t), passed from and returned as int.
UInt8FFI tag for an 8-bit unsigned integer (uint8_t), passed from and returned as int.
UInt16FFI tag for a 16-bit unsigned integer (uint16_t), passed from and returned as int.
UInt32FFI tag for a 32-bit unsigned integer (uint32_t), passed from and returned as int.
UInt64FFI tag for a 64-bit unsigned integer (uint64_t), passed from and returned as int.
PtrFFI tag for a raw pointer (void *), returned as an int address.
CallbackFFI tag for a C function pointer, letting C call back into a Coil function.
StructFFI tag for a C struct passed or returned by value.
BytesFFI tag for a writable byte buffer (uint8_t *) made from a Vec<byte>.
ConstBytesFFI tag for a read-only byte view (const uint8_t *) of a string or Vec<byte>.
↑ ↓ navigate ↵ open