wasm Backend Link Options
Configurable Options
-
The
exports
option is used to specify the function names exported by thewasm
backend.For example, in the following configuration, the
hello
function from the current package is exported as thehello
function in thewasm
module, and thefoo
function is exported as thebar
function in thewasm
module. In thewasm
host, thehello
andbar
functions can be called to invoke thehello
andfoo
functions from the current package.{ "link": { "wasm": { "exports": [ "hello", "foo:bar" ] } } }
-
The
heap-start-address
option is used to specify the starting address of the linear memory that can be used when compiling to thewasm
backend.For example, the following configuration sets the starting address of the linear memory to 1024.
{ "link": { "wasm": { "heap-start-address": 1024 } } }
-
The
import-memory
option is used to specify the linear memory imported by thewasm
module.For example, the following configuration specifies that the linear memory imported by the
wasm
module is thememory
variable from theenv
module.{ "link": { "wasm": { "import-memory": { "module": "env", "name": "memory" } } } }
-
The
export-memory-name
option is used to specify the name of the linear memory exported by thewasm
module.{ "link": { "wasm": { "export-memory-name": "memory" } } }