Skip to content
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

Is there a MemoryInterop example with C++ #48

Open
lanny886 opened this issue Jun 2, 2023 · 1 comment
Open

Is there a MemoryInterop example with C++ #48

lanny886 opened this issue Jun 2, 2023 · 1 comment

Comments

@lanny886
Copy link

lanny886 commented Jun 2, 2023

I generate .wasm from cpp with emcc , pass malloc address to java, but can not read value by ByteBuffer, also can not modify value by ByteBuffer when read value in c++ later. By the way, when pass const char* address to java, can read value correctly.

@kawamuray
Copy link
Owner

wasm module/runtime can read/write from/to linear memory only https://wasmbyexample.dev/examples/webassembly-linear-memory/webassembly-linear-memory.rust.en-us.html so maybe the address you're passing around isn't valid in that regard.
Anyway, without more information provided there's too many possibilities to guess. One thing you can do is to try running your wasm module using wasmtime command directly, and if it still fails that is a problem of either wasntime runtime or your compiled wasm module.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants