MCPcopy Create free account
hub / github.com/bytecodealliance/wasmtime / func_new

Method func_new

crates/c-api/include/wasmtime/linker.hh:126–142  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

124 Span<const Val>, Span<Val>>,
125 bool> = true>
126 Result<std::monostate> func_new(std::string_view module,
127 std::string_view name, const FuncType &ty,
128 F &&f) {
129
130 auto *error = wasmtime_linker_define_func(
131 ptr.get(), module.data(), module.length(), name.data(), name.length(),
132 ty.ptr.get(), Func::raw_callback<std::remove_reference_t<F>>,
133 std::make_unique<std::remove_reference_t<F>>(std::forward<F>(f))
134 .release(),
135 Func::raw_finalize<std::remove_reference_t<F>>);
136
137 if (error != nullptr) {
138 return Error(error);
139 }
140
141 return std::monostate();
142 }
143
144 /// Defines a new function in this linker in the style of the `Func::wrap`
145 /// constructor.

Callers 3

TESTFunction · 0.45

Calls 5

releaseMethod · 0.80
ErrorClass · 0.70
getMethod · 0.45
dataMethod · 0.45

Tested by 1

TESTFunction · 0.36