diff --git a/ToolchainIndependentABI.md b/ToolchainIndependentABI.md new file mode 100644 index 0000000..10d7151 --- /dev/null +++ b/ToolchainIndependentABI.md @@ -0,0 +1,16 @@ +Toolchain-independent ABI +========================= + +There are many different ways to use Wasm modules, and many different +conventions and toolchain-specific ABIs. This document describes ABI features +intended to be common across all ABIs. + +## The `_initialize` function + +If a module exports a function named `_initialize` with no arguments and no +return values, and does not export a function named `_start`, the toolchain +that produced my assume that on any instance of the module, this `_initialize` +function is called before any other exports are accessed. + +This is intended to support language features such as C++ static constructors, +as well as "top-level scripts" in many scripting languages.