liveBook · Manning

Application binary interface

As explained in Refactoring to Rust

An ABI is a binary-level calling convention and interface specification governing how separately compiled software components interact.

An application binary interface (ABI) is a low-level protocol that lets separately compiled binary modules interact through machine or assembly code. Unlike a higher-level API, it specifies the interfaces a runtime and module use to communicate. section 10.0

WebAssembly System Interface (WASI) uses an ABI to connect WebAssembly modules with their underlying system. A compatible runtime supplies the implementation, allowing one compiled module to run in different environments without rewriting its core logic. section 10.0 section 10.2

An ABI-based WebAssembly workflow separates responsibilities:

  • Compile application code into a WebAssembly module. section 10.0
  • Target a runtime such as WasmEdge so Rust uses the runtime's supported interfaces. section 10.2
  • Let the runtime mount the module, call its main function, and handle operating-system interaction. section 10.2
  • Pass application arguments through the module's argument list rather than changing the binary's internal logic. section 10.2

Running a Rust search module

A Rust search application separates reusable search logic into a library and exposes a binary entry point. Compiling for wasm32-wasi and running the resulting module with WasmEdge lets the runtime call main, provide system interaction, and accept a search term such as "test". section 10.2

How Refactoring to Rust covers it

How deep it goes
Defines ABI as binary interoperability and demonstrates runtime integration, but stops short of detailing calling-convention layouts or binary encoding.
Examples
Demonstrates a Rust search module compiled for wasm32-wasi, executed by WasmEdge, and supplied with command-line arguments.
What you can do after
Operate/configure a Rust WebAssembly module for a compatible runtime and pass arguments through its binary interface.
How it connects
Connects application binary interfaces with WebAssembly, WASI, runtimes, portability, and higher-level APIs.

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Refactoring to Rust. The section links point to the parts of the book it draws on.