Closed vshymanskyy closed 2 years ago
I have prototyped this as I was running into issues with the old version of Wasm3 currently supported by this crate. I use only the types and functions exposed in wasm3.h
and m3_api_wasi.h
(if the wasi
feature is enabled). However, this crate makes heavy use of internal structs, and so not all exposed functionality is available using only the public API. In particular, I had to remove this functions:
Function::import_module_name
(The name of the import module of this function)Module::function
(Looks up a function by its index in this module)Runtime::find_module
(Searches for a module with the given name in the runtime's loaded modules)Runtime::modules
(Returns an iterator over the runtime's loaded modules)Runtime::resize_memory
(Resizes the number of allocatable pages to num_pages)Runtime::stack and stack_mut
(Returns the stack of this runtime)So we could either add to the wasm3 API to keep these or remove them from the Rust API. I'd be happy to open a PR with my changes, which has bindings to the v0.5.0 release.
With latest Wasm3 (v0.5.0), new API is available which fixes many things in the public API:
_ctx
argument)m3_Call
invocation. I.e. calling exported function from within imported function callback.m3_RunStart
can be used to force the module initialization.I think all this can greatly help your bindings implementation. @Veykril please let me know it you need any other public API, or have any ideas!
This is already implemented in Python bindings, you can use it as a reference: https://github.com/wasm3/wasm3/blob/master/platforms/python/m3module.c