Module wasmer::wasm_c_api

source ·
Expand description

Implementation of the official WebAssembly C API for Wasmer.

We would like to remind the reader that this official standard can be characterized as a living standard. As such, the API is not yet stable, even though it shows maturity over time. The API is described by the wasm.h C header, which is included by wasmer.h C header file (which contains extension of the standard API, for example to provide WASI or vendor-specific features).

Quick Guide

Usually, the user first needs to create an engine and a store. Once it’s done, the user needs to create a module and then instantiate it. When instantiating the module, the user is able to pass a set of imports. With an instance, the user is able to call the exports.

Every module comes with examples and entry points to guide the discovery of this API.

Modules

  • An engine drives the compilation and the runtime.
  • cbindgen:ignore
  • A WebAssembly instance is a stateful, executable instance of a WebAssembly module.
  • A WebAssembly module contains stateless WebAssembly code that has already been compiled and can be instantiated multiple times.
  • A store represents all global state that can be manipulated by WebAssembly programs. It consists of the runtime representation of all instances of functions, tables, memories, and globals that have been allocated during the lifetime of the abstract machine.
  • A trap represents an error which stores trace message with backtrace.
  • cbindgen:ignore
  • This module contains unstable non-standard C API.
  • Possible runtime values that a WebAssembly module can either consume or produce.
  • Wasmer-specific API to get or query the version of this Wasm C API.
  • Unofficial API for WASI integrating with the standard Wasm C API.
  • Wasmer-specific API to transform the WAT format into Wasm bytes.