pointer


Vocabulary
alien.c-types

Class description
Represents a pointer C type. The to slot contains the C type being pointed to. Both byte-array and alien values can be provided as pointer function inputs, but see Byte arrays and the garbage collector for notes about passing byte arrays into C functions. Objects with methods on >c-ptr, such as structs and specialized arrays, may also be used as pointer inputs.

Pointer output values are represented in Factor as aliens. If the pointed-to type is a struct, the alien will automatically be wrapped in a struct object if it is not null.

In TYPEDEF:, FUNCTION:, CALLBACK:, and STRUCT: definitions, pointer types can be created by suffixing * to a C type name. Outside of FFI definitions, a pointer C type can be created using the pointer: syntax word:

FUNCTION: int* foo ( char* bar )

: foo ( bar -- int* )
pointer: int f "foo" { pointer: char } f alien-invoke ;


Definition


Methods