Nanyx
PlaygroundPackages

host.runtime

The privileged layer a host is written on

Only a host imports nanyx/host.runtime, as the console host the compiler ships, nanyx.console/console.host, does. How hosts work, and how to write one, is described in Hosts.

Reference

The capability a host is written on: what lets it call the foreign functions its embedder provides (those declared with @extern) and reach the module’s linear memory (with nanyx/host.memory).

HostRuntime is provided only to the host, the package whose modules run the program’s entry point (as the console host, nanyx.console, does). Anywhere else, requiring it is an error, so a library can only reach the outside world through the contexts the host chose to provide.

HostRuntime

context HostRuntime = protected ()

The capability that marks the host. It has no members: every foreign function, and every function of nanyx/host.memory, requires it, so only the host’s code can call them.