I’m currently working on a project with dynamic loading of WASM code and native bindings. I used to use WAMR but due to its lack of support for iOS, I decided to give wasm3 a go.
Unfortunately, it’s not really working as expected. My current workflow to build a loadable wasm module is to declare a shared library with Build.addSharedLibrary(...) and I have a very simple zig file with various export and extern functions declared.
The issue now is that the resulting wasm module, when I look at it with wasm2wat, contains an import from “env” of the memory. If I understand correctly, wasm3 is not compatible to such a thing.
Would anyone know if there is a workaround for that ?
I don’t really have a strong knowledge of these concepts yet and thus randomly tried to use the export_memory flag but that seems to be incompatible with shared libraries.
As a alternate method that I used, I have a project layout with a shared lib file which I import in multiple component files. So the exports are defined in the lib file, then exposed from the different components. Where each component must be build output as WASM (and implement the required interface). I think it demonstrates that the Zig builder gives us enough control to deal with custom situations.