-
Notifications
You must be signed in to change notification settings - Fork 829
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
--invoke does not call invoked function #1024
Comments
It looks like we only run invoke on no-ABI modules right now. It's easy to fix, but it will do the wrong thing with WASI a lot of the time. WASI currently only supports being run as an executable which means we have to execute I'll make it work with WASI too and add a warning saying as much! |
Thanks for making this work! So, when intending to invoke other functions in WASI modules, I presume is generally wise to first invoke |
Yeah, that's correct: currently to fully use WASI as a library you have to call main. If you can trust main to return then that's the easiest solution. I believe it should be possible to use metering here too, but I don't think we have a standardized, ready to use solution for this use case. It would be nice to have these types of things provided by use directly. I think this will be added to WASI somewhat soon I'd imagine -- explicit setting up of the guest-side filesystem data structures without invoking main I mean. edit: to clarify what I mean about metering is that you have to set up metering yourself; we don't have a single function or bool you can pass somewhere and have it just work yet for this specific use case which is unfortunate. |
Thanks for the solution and for the background information - both very useful. The PR does indeed fix calling functions in WASI ABI modules:
|
To run our C++ based framework, we need to invoke an exported function
pred()
in a WASI standalone Webassembly binary compiled using Emscripten. The main() and pred() functions are defined as follows:Running WAVM works fine:
But running the same using Wasmer results in it calling the default
main()
function:Just to make sure, we also tested:
But that also resulted in calling main.
See also the possibly related issue here: wasmerio/wasmer-go#91
The text was updated successfully, but these errors were encountered: