ffi
ffi.tolk standard library file
Namespace for host-provided functions implemented via EXTCALL.
ffi is the low-level boundary between Tolk stdlib code and the Acton host
runtime. Most user code should import higher-level modules instead of
calling ffi.* directly.
Each declaration like fun ffi.foo(...): ... asm "<id> EXTCALL" is a contract between
stdlib code and the host runtime: opcode id and argument count must match the registered
runtime handler.
FFI handlers are injected by Acton host executors (for example script/test/emulation runs).
Without host registration for a given opcode, that EXTCALL is unavailable at runtime.
This surface is meant for host-driven execution contexts such as acton test,
acton script, and local emulation helpers. It is not part of deployed
on-chain contract execution on the real network.
On the host side, these handlers are registered from Rust modules under
src/ffi/. If you add or change a direct ffi.* declaration, its opcode id,
argument count, and value encoding must stay in sync with the corresponding
host implementation.
In practice, direct ffi.* declarations are mostly for Acton internals and
host-extension work. For ordinary tests and scripts, prefer the stable
wrappers exposed by the higher-level stdlib modules above.
Last updated on