-
Notifications
You must be signed in to change notification settings - Fork 262
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add application-abi describing WASI application lifecycle
- Loading branch information
Showing
1 changed file
with
31 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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`. |