⎕FFI FFI r←[x] ⎕FFI y
Category: FFI
r is a wrap containing the function described by y in the dynamic library at path x, which defaults to the C standard library if not provided. y is a vector of at least two strings. The first element of y is the return type of the function; the second element is the name of the symbol; the elements after the second are the arguments of the function. The resulting wrapped function must be called monadically with a vector of arguments.
Types
void: Cvoidu8: Cuint8_tu16: Cuint16_tu32: Cuint32_tu64: Cuint64_tsee notei8: Cint8_ti16: Cint16_ti32: Cint32_ti64: Cint64_tsee noteuint: Cunsigned intint: Cintulong: Cunsigned longlong: Clongusize: Csize_tsee notef32: Cfloatf64: Cdoublec8: Cchar8_tc16: Cchar16_tc32: Cchar32_tuchar: Cunsigned charchar: Ccharwchar: Cwchar_tstr: Cchar*[]x: Cx[]*x: Cx*
Note: 64-bit integers don't necessarily fit in the 64-bit floating point type that TinyAPL uses. You won't be able to accurately pass nor be returned values with absolute value greater than
9007199254740991.
Pointers
Functions that take and return pointers use a special pointer struct with the following members:
address: a number containing the address pointed tosize: the size in bytes of the datatype pointed toPeek: value at offset⍵PeekB: value at offset⍵(in bytes)PeekL:⍵values, at offset⍺, which defaults to0PeekE: monadically read until zero value is found, starting at offset⍵; dyadically read until value⍵is found, starting at offset⍺Poke: write value⍵at offset⍺, which defaults to0PokeB: write value⍵at offset⍺(in bytes)PokeA: write values from vector⍵starting at offset⍺, which defaults to0PokeE: write values from vector⍵terminated by zero if monadic and⍺if dyadicCast: return a pointer to the same address but with a different datatype⍵+: offset a pointer by an integerAddB: offset a pointer by an integer (in bytes)-: offset a pointer by an integer, or find the distance between two pointersSubB: offset a pointer by an integer (in bytes), or find the distance (in bytes) between two pointers⧺: increment a pointer by one byteⵧ: decrement a pointer by one byte×: is the pointer not null?