wit-bindgen
wit-bindgen copied to clipboard
wit-bindgen support for wasm start
@sunfishcode is the discussion in https://github.com/WebAssembly/WASI/issues/19 relevant to this one?
It is, though a lot of the discussion there reflects the uncertainty at the time about the relationship between a wasm module and the outside environment. Many of the questions now have answers in the component model.
The conceptual interface to the outside world is a component interface. But there's also a conceptual inner core module which implements a lowered form of the component interface through an adapter layer, for now using the Canonical ABI.
So for the start function: Unlike the discussion in https://github.com/WebAssembly/WASI/issues/19, we now know that components are acyclic, so the outer component can use the start function for running main
functions (Yay!). But like the discussion in https://github.com/WebAssembly/WASI/issues/19, the inner core module will still need to export its linear memory and have a cyclic linking relationship with the Canonical ABI, so we won't be able to use the wasm start function in the core module.
So we'll need the Canonical ABI to define a core-module exported function that is called at the logical time when the component start function is called. The call will happen after the core module is initialized and its exports are available.
We'll need to pick a name for this function, and the main task there is to simply pick something nicer than _start
:wink: .
I'm going to close this for the same reasons as I mentioned in https://github.com/bytecodealliance/wit-bindgen/issues/263#issuecomment-1247030167