wasmtime-dotnet icon indicating copy to clipboard operation
wasmtime-dotnet copied to clipboard

Fix issues in `Function.FromCallback()` and `Linker.DefineFunction()`

Open kpreisser opened this issue 2 years ago • 0 comments

Hi, this is a PR to fix the following issues when using Function.FromCallback() and Linker.DefineFunction():

  • Instead of invoking callback.Method (that may have a different parameter count than the callback), invoke the callback's Invoke method.
  • Handle an ITuple return value only when GetFunctionType() determined that the function returns a tuple, to correctly return a boxed ValueTuple as externref.
  • Support nested levels of ValueTuples, so that it's possible e.g. to return a ValueTulple<..., ValueTuple<..., ValueTuple<...>>> (15 values).

Fixes #158 Fixes #159

Thank you!

kpreisser avatar Oct 10 '22 17:10 kpreisser