Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Investigate adding support for Nim ( and reactors ) #217

Closed
pmp-p opened this issue Jan 15, 2023 · 3 comments · Fixed by #291
Closed

Investigate adding support for Nim ( and reactors ) #217

pmp-p opened this issue Jan 15, 2023 · 3 comments · Fixed by #291

Comments

@pmp-p
Copy link

pmp-p commented Jan 15, 2023

i left you a note on discord about that. I had success to build wasi app with wasm-sdk-19 + Nim but i'm having trouble to find a wasi web runner that would offer support for reactors in order to set a standard for using https://developer.mozilla.org/en-US/docs/Web/API/window/requestAnimationFrame as it should


References:

@taybenlor
Copy link
Owner

Thanks Paul! I've responded in discord. This looks very doable. Is there a description somewhere of how to call a WASI binary that uses reactors? I can see that you start by calling _initialize and then you're meant to call a main loop function, but what is that called?

It looks like I might have to read more about the Component model and how it composes collections of imports/exports.

@amesgen
Copy link

amesgen commented Jan 6, 2024

I can see that you start by calling _initialize and then you're meant to call a main loop function, but what is that called?

There is no specific main loop function afterwards, the intention is that the user will then call specific WASM exports as necessary, see https://github.com/WebAssembly/WASI/blob/main/legacy/application-abi.md.

For comparison, see bjorn3/browser_wasi_shim#17 for how another browser WASI shim implements support for WASI reactors.

For @runno/wasi, one can currently do this via

wasi.instance = instance;
wasi.memory = instance.exports.memory;
instance.exports._initialize();

but one could also add a helper function (similar to wasi.start) for this as in bjorn3/browser_wasi_shim#17, but it might make sense to wait until the component model/wasi_snapshot_preview2 is ready.

@taybenlor
Copy link
Owner

Thanks @amesgen! This looks pretty simple to do. I've been trying to follow the NodeJS API (https://nodejs.org/api/wasi.html). I'll have a look at implementing it that way.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants