Skip to content

Commit

Permalink
Add application-abi describing WASI application lifecycle
Browse files Browse the repository at this point in the history
  • Loading branch information
sbc100 committed May 30, 2019
1 parent 9e8f0d3 commit 78863fc
Showing 1 changed file with 31 additions and 0 deletions.
31 changes: 31 additions & 0 deletions design/application-abi.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
WASI Application ABI
====================

In addition to the APIs defined by the various WASI [modules](modules.md) there
are also certain expectations that the WASI runtime places on an application
that wishes to be portable across WASI implementations.

This document descibes how a conforming WASI application is expected to behave
in terms of lifecycle (startup, shutdown, etc) any exports it is expected to
provide in order to for the embedder to load and run

Lifecycle
---------

A WASI program may contain any number exports, but the embedded attributes
specific meaning the following optional function exports:

- `__wasi_init` - Called after WebAssemembly instancation but before any other
functions.
- `__wasi_main` - Runs the programs main entry points.
- `__wasi_term` - The logical inverse of `__wasi_init`. Optionally called
before modules destruction. No other functions within program will be called
after this one.

Linear Memory
-------------

All WASI programs are expected to share a linear memory with the embedder. The
memory can either be imported from the embedder or exports to the embedder. If
exported the memory must be named `__wasi_memory`. If imported the import must
be named `memory` from a module names `wasi`.

0 comments on commit 78863fc

Please sign in to comment.