Improve return value types in the C API #4
Labels
c-api
libwasm_runtime C API
🚀 enhancement
New feature or request
💡looking for ideas
Issue under discussion and looking for new ideas
@ereslibre initiated an interesting discussion about the return value types in the C API.
Currently, some functions return a
*const c_char
as a result:So there is no formal way to distinguish whether the returned data is the expected output or a text explaining the error.
We should explore returning a
CResult
that looks like this:Or we could go for this other approach of result-type-in.c.
An example of mod_wasm.c code that is missing error logging is the Wasm execution invocation. We don't know if the returned string was the expected output or not.
In any case, we should take care of returning the string ownership to Rust.
I am opening this issue to have a discussion about it.
The text was updated successfully, but these errors were encountered: