Languages
A mod is a WebAssembly module, so any language that compiles to plain wasm32 and can declare a wasm
import can be used to write one. Three have been built and checked against the surface: C, C++ and
Rust. This page says what each one gets, and what a pack is written in.
Which language to pick
Pick C if you want the shortest path: every example in these docs is C, and it is what the host is
tested with. Pick Rust if you want the compiler on your side and do not mind unsafe at the
boundary. Pick C++ for classes and templates without a library behind them.
Whatever the language, the result is the same: a mod.wasm whose imports the host checks name by name
and type by type against the surface, beside an axiom.toml. The host cannot tell which language a
mod was written in, and nothing else in these docs changes with it.
Downloads
Both are generated from the same surface as the capability reference, so a call in one is a call in the other, with the same import name and the same signature.
Other languages
Any other language works on the same terms, untested: it must compile to wasm32 with no WASI and no
runtime of its own, and it must declare each import from the module axiom:<capability> under the
call's name, with the signature surface.h gives. Two things stop a module loading, and they catch
most toolchains:
- WASI. A module built for WASI imports
wasi_snapshot_preview1, which the surface does not offer, so it is refused asUnknown. Target the barewasm32(for Rust,wasm32-unknown-unknown, notwasm32-wasip1). - Host memory, tables or globals. A module must define its own memory. One that imports memory is
refused as
Linkage.
The guest ABI has the lowering table, which is the whole contract.
What a pack is written in
A pack is a pack.toml, whatever the game is written in: a flat pool for a native game, a sparse pool
for a managed one. It holds names and offsets, not code, and needs no compiler.
Writing a pack is the reference.
A pack written as code, for a world pack.toml cannot describe, is planned, and nothing hosts one
yet, so no language for it is settled.