How do I get a exported function by name? Rust's got get_typed_func, but I can't find anything similar in the C API. Most of the C examples get externs funcs by index.
Currently we don't have an equivalent in the C API
one of the main reasons is that we're not ready to commit yet to a stable ABI for functions, so there's no great way to expose this in C right now (that we know of)
Thanks for the response, it's quite alright. I've managed to work around it with wasm_module_exports, just by mapping the externtype names to extern indices. It's a glued on solution but seems to work well enough for now.
It is actually not a workaround. That's how you need to do it.
Hi Yury. What do you mean?
I'm not interested in the function's signature if that's what you meant.
In most of the cases binding by name is inefficient or tricky at runtime. The C api "suggest" that all inefficient stuff will be accomplish during initial linking and indexes are used instead of names later during runtime.
That's what I'm doing. I'm building up a map of name's to extern indices after I load the module binary.
Last updated: Dec 23 2024 at 12:05 UTC