Skip to content

Commit f5f9a6a

Browse files
committed
Give mut access to component params (to take if desired)
1 parent f65027c commit f5f9a6a

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

crates/c-api/include/wasmtime/component/linker.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ WASM_API_EXTERN wasmtime_error_t *wasmtime_component_linker_instance_add_module(
127127

128128
/// Type of the callback used in #wasmtime_component_linker_instance_add_func
129129
typedef wasmtime_error_t *(*wasmtime_component_func_callback_t)(
130-
void *, wasmtime_context_t *, const wasmtime_component_val_t *, size_t,
130+
void *, wasmtime_context_t *, wasmtime_component_val_t *, size_t,
131131
wasmtime_component_val_t *, size_t);
132132

133133
/**

crates/c-api/src/component/linker.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ pub unsafe extern "C" fn wasmtime_component_linker_instance_add_module(
9999
pub type wasmtime_component_func_callback_t = extern "C" fn(
100100
*mut c_void,
101101
WasmtimeStoreContextMut<'_>,
102-
*const wasmtime_component_val_t,
102+
*mut wasmtime_component_val_t,
103103
usize,
104104
*mut wasmtime_component_val_t,
105105
usize,
@@ -126,7 +126,7 @@ pub unsafe extern "C" fn wasmtime_component_linker_instance_add_func(
126126
.func_new(&name, move |ctx, args, rets| {
127127
let _ = &foreign;
128128

129-
let args = args
129+
let mut args = args
130130
.iter()
131131
.map(|x| wasmtime_component_val_t::from(x))
132132
.collect::<Vec<_>>();
@@ -136,7 +136,7 @@ pub unsafe extern "C" fn wasmtime_component_linker_instance_add_func(
136136
let res = callback(
137137
foreign.data,
138138
ctx,
139-
args.as_ptr(),
139+
args.as_mut_ptr(),
140140
args.len(),
141141
c_rets.as_mut_ptr(),
142142
c_rets.len(),

0 commit comments

Comments
 (0)