Skip to content

Commit ed67f4c

Browse files
committed
Describe new-style commands.
The core idea of new-style commands is that all function exports are command entrypoints, and they expect to be called on a fresh instance which lives only for the direction of the call. This is a generalization of the existing `_start` convention, which already has the expectation of a fresh instance which lives only for the direction of the call, and is one of the pieces need to enable user-defined command entrypoints which don't take string arguments and don't return an i32 status code. To show how this works in practice, the following patches implement this new behavior in wasm-ld and wasi-libc: - https://reviews.llvm.org/D81689 - WebAssembly/wasi-libc#203
1 parent 897d819 commit ed67f4c

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

legacy/application-abi.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,14 @@ There are two kinds of modules:
1717
- A *command* exports a function named `_start`, with no arguments and no return
1818
values.
1919

20+
`_start` is the default export which is called when the user doesn't select a
21+
specific function to call. Commands may also export additional functions,
22+
(similar to "multi-call" executables), which may be explicitly selected by the
23+
user to run instead.
24+
25+
Except as noted below, commands shall not export any mutable globals, tables,
26+
or linear memories.
27+
2028
Command instances may assume that they will be called from the environment
2129
at most once. Command instances may assume that none of their exports are
2230
accessed outside the duration of that call.

0 commit comments

Comments
 (0)