-
Notifications
You must be signed in to change notification settings - Fork 79
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
Custom Sections API #168
Comments
Proposed API: WASM_API_EXTERN void wasm_module_custom_sections(
const wasm_module_t* module,
const wasm_name_t* name,
own wasm_byte_vec_t** out,
); where:
The ownership of If To make things simpler, we could create a new type: typedef wasm_byte_vec_t wasm_custom_section_t;
WASM_DECLARE_VEC(custom_section, )
WASM_API_EXTERN void wasm_module_custom_sections(
const wasm_module_t* module,
const wasm_name_t* name,
own wasm_custom_section_vec_t* out,
); Thoughts? |
Ah, note that a wasm_module_t represents an already decoded module, which isn't necessarily expected to keep a reference to the binary it originated from. So the API will need to extract custom sections from binaries, not module objects. |
Additional note: @Hywan’s proposal seems to encompass only a lookup; it would seem more ideal if the API were a lister/iterator pattern? e.g.:
(Please forgive the inexactitude of the above … I’m still rather new to WASM.) |
On the JS API, the object taken for At Wasmer we also store those custom section bytes in the compiled Artifact of the module. I guess it's likely that if V8 adds some caching to Wasm Compiled objects (if doesn't have it yet), a similar approach will be taken? (since it saves more space only storing the custom sections along the compiled artifact than saving the whole Wasm file with the compiled artifact). Do you think is worth to mimic the JS API behavior in C? (taking a object module instead of a vec of wasm bytes). |
A user of Wasmer has just requested usage of the custom section API via our C bindings.
Wasmer is basing their new API based on Wasm-C-API, but it doesn't have an API yet for accessing data in custom sections. So it would be great to add one!
What you think the ideal API for accessing custom sections via Wasm-C-API would be? Do you think that's something the project would benefit from? (if so, we will be super happy to open a PR/proposal!)
More context: wasmerio/wasmer#2285
The text was updated successfully, but these errors were encountered: