-
Notifications
You must be signed in to change notification settings - Fork 824
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
Accessing global arrays in the guest from host, when embedded? #319
Comments
@lachlansneff I think we are missing @hrydgard I modified your example to inspect the global value:
which resulting in the following:
I suspect this value
and then print this part of the memory:
Results in:
So, it appears that the |
Ah, thanks! Good that it's there. Could be clearer in the documentation though... GlobalDescriptor is even entirely missing from the docs due to a missing /// comment line. Also it could be nice to add this stuff to the official example :) I'm sure other people will want to do similar things. |
320: Add Export and GlobalDescriptor to Runtime API r=syrusakbary a=bjfish This was mentioned in the issue: #319 It would be nice to be able to iterate exports without requiring `runtime-core`. Co-authored-by: Brandon Fish <[email protected]>
@bjfish I still believe you're missing documentation that you find the address of global arrays in the Value::I32, which I find somewhat unintuitive. Apart from that, all good! |
Summary
When embedded in a host Rust application, it does not seem to be possible to access the contents of guest global arrays from the host. And it's not even possible to list the exports without linking to wasmer_runtime_core.
Additional details
For example, if I add the following line to the example in https://github.com/wasmerio/wasmer-rust-example :
And then loop through instance.exports() in main.rs:
I do get the following:
So SCRATCH_I is there.
But how can I access the memory? Global does not seem to have a public way to get the address - if I had that, I could stash it away and then go directly to memory.
Or am I missing something?
The text was updated successfully, but these errors were encountered: