silk.platform.wasm.start.
The program entry for the standalone LLVM-to-WebAssembly profile.
When to use#
Select this module as the runtime root for a wasm32 program with no host services. The host
calls the exported main function with no arguments and gets an i32 exit status.
Details#
main in the application can return one of these types:
main returns | Exit status |
|---|---|
i32 | The value |
() | 0 |
Effect<() ! E> | 0 on success, 1 on a failure (E must implement Debug) |
The application runs inside its own Execution. Nested transfers complete before the exported
main returns. If the application is still parked at the end, or the Execution cannot be
allocated, the status is 1.
With the threading profile set to multi, the module also exports the entry that runs each
thread NativeThread.spawn starts.
Gotchas#
The host gives no arguments and no services. The application source supplies each service requirement.
The complete application call must satisfy
Intrinsic.NonParking. To park on an external event, the application must own that wait itself.A module has no descriptors, so the report of an unhandled error or a trap goes to a buffer in the module. The host reads it through the exported
silk_report(its address) andsilk_report_length; the std lib'shost/wasm-runner.mjsprints it, and rejects a trap with anErrorthat carries it. A report longer than 8 KiB is cut short.A fatal trap writes its report, then executes
unreachable, with no cleanup.A debug build keeps its DWARF out of the module:
silk buildwrites it as<output>.debug.wasm, which the module names inexternal_debug_info, and a source map as<output>.map, which it names insourceMappingURL. Serve both beside the module.
Public declarations: 0.
This module declares no public items.
Category: Native platform.
Profiles: aarch64-apple-darwin, aarch64-unknown-linux-gnu, aarch64-unknown-linux-gnu-no-libc, x86_64-unknown-linux-gnu, x86_64-unknown-linux-gnu-no-libc, wasm32-unknown-unknown, wasm32-wasip1, wasm32-wasip2.