WasmHostTrampoline constructor

WasmHostTrampoline(
  1. WasmFuncType signature,
  2. WasmHostFunction body
)

Implementation

WasmHostTrampoline(this.signature, this.body) {
  // `NativeCallable` takes the native signature; the Dart side of it uses
  // `int` where the native one uses `ffi.Size`, which is what `_invoke` has.
  // `_invoke` never throws (it turns failures into traps), so no exceptional
  // return value is needed - and a `Pointer` return type does not allow one.
  _callable =
      ffi.NativeCallable<c.wasmtime_func_callback_tFunction>.isolateLocal(
        _invoke,
      );
}