-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
Linker does not properly define imports (C API) #2211
Comments
Thanks for the report! The issue here is somewhat subtle and unfortunate. The |
I see, indeed it was very subtle. However wouldn't this be a defect for |
I believe the upstream API was adjusted in WebAssembly/wasm-c-api#151, and we haven't pulled in that update yet. |
Could this be addressed? The fix of pulling upstream should be trivial, no? |
We should be able to update the Wasmtime C API to fix this now. I'll try to get a fix up tomorrow. You should be able to work around the issue using |
This commit updates the WebAssembly C API submodule (for `wasm.h`) to the latest commit out of master. This fixes the behavior of `wasm_name_new_from_string` such that it no longer copies the null character into the name, which caused unexpected failures when using the Wasmtime linker as imports wouldn't resolve when the null was present. Along with this change were breaking changes to `wasm_func_call`, the host callback signatures, and `wasm_instance_new` to take a vector type instead of a pointer to an unsized array. As a result, Wasmtime language bindings based on the C API will need to be updated once this change is pulled in. Fixes bytecodealliance#2211. Fixes bytecodealliance#2131.
* Update WebAssembly C API submodule to latest commit. This commit updates the WebAssembly C API submodule (for `wasm.h`) to the latest commit out of master. This fixes the behavior of `wasm_name_new_from_string` such that it no longer copies the null character into the name, which caused unexpected failures when using the Wasmtime linker as imports wouldn't resolve when the null was present. Along with this change were breaking changes to `wasm_func_call`, the host callback signatures, and `wasm_instance_new` to take a vector type instead of a pointer to an unsized array. As a result, Wasmtime language bindings based on the C API will need to be updated once this change is pulled in. Fixes #2211. Fixes #2131. * Update Doxygen comments for wasm.h changes.
Using the C API, defining imports with the Linker do not work properly. When attempting to instantiate the module in question, it errors with the following:
unknown import: `env::Test` has not been defined
This is how the module is attempted to be instantiated:
This is the module that is being attempted to be loaded (compiled with clang):
The imports in the wat looks like this:
This was tested on Windows 10, using the C API build from https://github.com/bytecodealliance/wasmtime/releases/tag/v0.19.0.
The text was updated successfully, but these errors were encountered: