ffi
Foreign function interface, call C/Rust/Python/JS.
Load with: use ffi
Quick example
use ffi
result = ffild(\(x) x, "value", "value")
prn(result)
Functions
FFI context
ffine()
Creates a new instance.
ffity()
Performs the operation.
Library loading
ffild(ffi, p, opts)
Performs the operation. Takes ffi, p, opts.
ffisy(ffi, lib, sym)
Performs the operation. Takes ffi, lib, sym.
Type definitions
ffist(n, fields)
Sets a value or starts a process. Takes n, fields.
ffiun(n, mems)
Performs the operation. Takes n, mems.
ffien(n, vals)
Encodes. Takes n, vals.
ffifn(n, rv, args)
Finalises. Takes n, rv, args.
Memory marshalling
ffima(sz)
Performs the operation. Takes sz.
ffifr(p)
Creates from another format. Takes p.
ffird(p, off, ty)
Reads data. Takes p, off, ty.
ffiwr(p, off, v, ty)
Writes data. Takes p, off, v, ty.
ffipa(df, vals)
Parses. Takes df, vals.
ffiun1(df, buf)
Performs the operation. Takes df, buf.
String handling
ffist1(str_val)
Performs the operation. Takes str_val.
ffist2(p)
Performs the operation. Takes p.
Function calling
ffica(ffi, lib, func_name, rv, arg_types, a)
Performs the operation. Takes ffi, lib, func_name, rv, arg_types, a.
Callbacks (Ilusm -> C)
fficb(ffi, cb, rv, arg_types)
Performs the operation. Takes ffi, cb, rv, arg_types.
Array handling
ffimk(ty, sz)
Creates a new instance. Takes ty, sz.
ffias(arr, i, v)
Performs the operation. Takes arr, i, v.
ffiag(arr, i)
Performs the operation. Takes arr, i.
Python interop
ffipy()
Performs the operation.
ffipy1(nm)
Performs the operation. Takes nm.
ffipy2(obj, method_name, a)
Performs the operation. Takes obj, method_name, a.
ffipy3(obj, attr_name)
Performs the operation. Takes obj, attr_name.
ffipy4(obj, attr_name, v)
Performs the operation. Takes obj, attr_name, v.
Rust interop
ffiru(p)
Runs. Takes p.
Node.js interop
ffino()
Performs the operation.
ffino1(c)
Performs the operation. Takes c.
ffino2(nm)
Performs the operation. Takes nm.
Cleanup
fficl(ffi)
Closes or clears. Takes ffi.
Notes
- Foreign Function Interface - call native C functions from ilusm.