Skip to content

Commit

Permalink
arguments as view
Browse files Browse the repository at this point in the history
  • Loading branch information
cpetig committed Sep 11, 2024
1 parent 5e9d573 commit 068a918
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions crates/cpp/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2860,6 +2860,13 @@ impl<'a, 'b> Bindgen for FunctionBindgen<'a, 'b> {
let result = if self.gen.gen.opts.host {
uwriteln!(self.src, "{inner} const* ptr{tmp} = ({inner} const*)wasm_runtime_addr_app_to_native(wasm_runtime_get_module_inst(exec_env), {});\n", operands[0]);
format!("wit::span<{inner} const>(ptr{}, (size_t){len})", tmp)
} else if self.gen.gen.opts.new_api
&& matches!(self.variant, AbiVariant::GuestExport)
{
format!(
"wit::vector<{inner} const>(({inner}*)({}), {len}).get_view()",
operands[0]
)
} else {
format!("wit::vector<{inner}>(({inner}*)({}), {len})", operands[0])
};
Expand Down

0 comments on commit 068a918

Please sign in to comment.