| 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. |