-
Notifications
You must be signed in to change notification settings - Fork 7
Open
Description
Hello!
I am interested by loading in Java a WebAssembly created using the crate wit_bindgen
. Actually I was looking for the Java bindings for this but I could not find any related project. As you probably already know, having this would allow to have a common WASM loaded by different languages (Python, Java, C, etc.).
I run your project wasmtime-java
(and thanks for this) with a wit-bindgen generated WASM but I encounter 2 problems:
- this first problem deals with the
de/allocation
functions: forwasmtime-java
, the WASM file needs to have the 2 exported functions__alloc_bytes
and__dealloc_bytes
). Even this is not ideal, I temporarly added these functions (of course it would be better to use the existing wit-bindgen allocation functions) - the second problem occurs when function-signature (in WASM) looks like
fn my_function(input: Vec<u8>) -> Vec<u8>
. I cannot find a way to load the return value. I confirm that I can "see" the expected result in the WASM memory but I dont understand how to find the correct offset of this result in memory (and the related result size in bytes). The offset returned by the function call (which is correct) does not match the good offset of the result.
Could I ask your opinion about this?
Thanks!!
Metadata
Metadata
Assignees
Labels
No labels