4 ms·
Until you find out WebAssembly can't call any native functions (for example: to create a GUI, to call a .so / .dll export, etc.) There was discussion to add `d
by MuffinFlavored 7y ago
Until you find out WebAssembly can't call any native functions (for example: to create a GUI, to call a .so / .dll export, etc.)
There was discussion to add `dl_open` + `dl_sym` to WASI but it got shot down. WebAssembly seems to be in a weird state of "look, I can run in and out of the browser, but I can't actually do anything useful out of the browser, and I can't access the DOM without going through JavaScript in the browser"
- flohofwoe 7y agoWASM embeddings like https://github.com/wasmerio/wasmer-c-api https://github.com/wasmerio/wasmer-c-api should allow that, at least calling from the embedder into WASM, and from WASM into the embedder. (e.g. see https://github.com/wasmerio/wasmer-c-api/blob/master/wasmer-c-api-example.c https://github.com/wasmerio/wasmer-c-api/blob/master/wasmer-...) There's similar embeddings for other languages here (python, go, ruby etc...): https://github.com/wasmerio https://github.com/wasmerio
- MuffinFlavored 7y agoI can't think of any good use cases for loading WebAssembly modules into native code. I also think it's bad out of the gates that the WebAssembly community is so fragmented across the different runtimes (each offering different functionality at the moment).
- flohofwoe 7y agoThink of plugins for applications like Autodesk Maya. Currently these are either cross-platform, but very slow Python plugins, or fast native DLLs which need to be compiled for each app-version/OS/CPU combination. If Maya had an embedded WASM runtime it could support plugins which are fast (at least much closer to native speed than Python scripts), and you only need to distribute a single WASM blob.
- MuffinFlavored 7y agoWhy not just use Lua?
- flohofwoe 7y agoSometimes you need to embed libraries which are only available as C or C++, or other programming languages. If this code needs to be included into the Lua plugin as CPU/OS specific DLLs you're back at the current mess.
- cpeterso 7y agoFastly is building a WebAssembly runtime on its edge servers so customers can run their own sandboxed WebAssembly closer to clients: https://www.fastly.com/blog/announcing-lucet-fastly-native-webassembly-compiler-runtime https://www.fastly.com/blog/announcing-lucet-fastly-native-w...
- MuffinFlavored 7y agoWasmer Lucet wasm-jit-prototype None of them will let your WebAssembly code call an exported function from a shared library. As an exercise, try to call https://docs.microsoft.com/en-us/windows/win32/api/winuser/nf-winuser-messagebox https://docs.microsoft.com/en-us/windows/win32/api/winuser/n... from WebAssembly.