I'm wondering - with the recent changes that allow wasm32-unknown-unknown
to use the "correct" WASM C ABI via a flag (Rust PR #117919), is it now technically possible to link a wasm32-unknown-unknown
dependency within a wasm32-unknown-emscripten
crate?
You can't use a dependency compiled for one target with another target as regular rust dependency. That only works if you are using the C abi and linking it like a C library. Both targets have a different standard library, differently mangled symbols and a different Rust ABI.
Right. I'm mostly interested in compiling wasm32-unknown-unknown
libs to use with a Emscripten CPython. I think most imlpementation (like Pyodide) use dlopen
- so that would be the technically possible I suppose?
Is there a reason you aren't compiling those crates as wasm32-unknown-emscripten? Is it because they depend on wasm-bindgen? If so emscripten and wasm-bindgen can't easily work together as both generate their own javascript wrapper for interfacing with web interfaces. They each claim unique ownership over the WebAssembly.Instance that runs your code.
It's mostly due to wasm-bindgen
, but also because the Emscripten target hasn't received much attention in the last few years. I know that wasm-bindgen
produces its own glue code, but I was hoping there might be a way to make it work with Emscripten somehow. Additionally, there's this crate: pyodide-webassembly-runtime-layer, which seems to provide interoperability with Pyodide's JS API.
This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.