-
Notifications
You must be signed in to change notification settings - Fork 171
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
Any example or documentation how to run it in browser? #235
Comments
You would need a Wasi web polyfill that provide all the syscalls you are using at runtime. |
If you are targeting the web then emscripten is really you best bet today. wasi-sdk it not really designed to target the web, at last not today. emscripten's output can be very small or very large depending on what features you use. You pay for what you use the compiler has good dead code elimination at In terms of supporting memory allocation, the allocator used in wasi-libc and emscripten is the same by default (dlmalloc). You can avoid malloc and free in both cases, but if your program depends on an allocator (indirectly) it will have roughly the same codesize cost in both wasi-sdk and emscripten. |
I found this package that looks very interesting: https://github.com/qrdate/tinywasi the code is easy to read. take a look: https://github.com/qrdate/tinywasi/blob/main/src/TinyWASI.ts |
You are looking for WASI polyfill for browser, written in pure JS, compatible with Node.js WASI API. |
Fascinating. That just saved me asking a question here. I was going the try to use the WASI-SDK I downloaded instead of downloading Emscripten, which results in the temporary file system I am building on running out of disk space during downloading. |
I want use wasi-sdk as backend c++ compiler/std-libraries to build my little library. Emscripten it seems too huge and highweight for my tasks. So I need just build library as wasm with supporting memory allocation(new/delete) and run functions from this library from javascript inside browser's page.
But i spent already many time to find normal tutorial: "from beginning to the end" - but found only very very scattered information with different technologies and libraries....
Is there any normal documentation: how can i just build c++ libarary with wasi-sdk and call it's functions from pure js ???
PS
I am very new in wasm - so sorry for may be dumb questions
The text was updated successfully, but these errors were encountered: