mirror of
https://github.com/fluencelabs/wasmer
synced 2025-06-12 08:31:21 +00:00
feat(runtime-c-api) Add an API to update vm::Ctx.data
.
This patch adds 2 functions for the runtime C API, respectively `wasmer_instance_context_data_set` and `wasmer_instance_context_data_get`. The goal is to modify the `vm::Ctx.data` field in the `runtime-core` library. This is required to pass dynamic data to imported functions for instance.
This commit is contained in:
@ -90,11 +90,11 @@ struct wasmer_instance_t {
|
||||
|
||||
};
|
||||
|
||||
struct wasmer_memory_t {
|
||||
struct wasmer_instance_context_t {
|
||||
|
||||
};
|
||||
|
||||
struct wasmer_instance_context_t {
|
||||
struct wasmer_memory_t {
|
||||
|
||||
};
|
||||
|
||||
@ -307,6 +307,13 @@ wasmer_result_t wasmer_instance_call(wasmer_instance_t *instance,
|
||||
wasmer_value_t *results,
|
||||
int results_len);
|
||||
|
||||
/// Gets the `data` field within the context.
|
||||
void *wasmer_instance_context_data_get(const wasmer_instance_context_t *ctx);
|
||||
|
||||
/// Sets the `data` field of the instance context. This context will be
|
||||
/// passed to all imported function for instance.
|
||||
void wasmer_instance_context_data_set(wasmer_instance_t *instance, void *data_ptr);
|
||||
|
||||
/// Gets the memory within the context at the index `memory_idx`.
|
||||
/// The index is always 0 until multiple memories are supported.
|
||||
const wasmer_memory_t *wasmer_instance_context_memory(const wasmer_instance_context_t *ctx,
|
||||
|
Reference in New Issue
Block a user