silk.platform.native.start.
The default start code of a native program: it calls your main and returns its status.
When to use#
The compiler uses this runtime for native programs on Darwin on aarch64, and Linux with GNU libc on x86_64 or aarch64. You do not call it.
Details#
main can return one of these:
i32, the exit status.(), for status 0.An effect that returns
i32or(), and that can require&mut HostInput. The runtime gives anOsHostInputwith the arguments and the environment of the process. Each error of the effect must implementDebug.
Other requirements, such as &mut Allocator, must be provided by your code. An unhandled error
prints a report to standard error and returns status 1. The report has at most 4096 bytes and 32
frames, and ends with an unhandled value: line that holds the error's Debug form, cut to
1024 bytes.
Gotchas#
There is no scheduler or event loop. If
mainparks, the program fails with status 1. Make your own execution for code that parks.A trap does not unwind, so cleanup code does not run.
A stack overflow on the main thread prints
fatal trap: stack overflow, and another invalid memory access printsfatal trap: segmentation fault, without frames. The process then ends with the signal, as it would without the report.
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.