bytecodealliance / wasmtime-dotnet

.NET embedding of Wasmtime https://bytecodealliance.github.io/wasmtime-dotnet/
Apache License 2.0
409 stars 52 forks source link

Wasmtime.WasmtimeException: Unable to create a callback with a return type of type 'System.UInt32' (and also with Uint64) #237

Closed viperscape closed 1 year ago

viperscape commented 1 year ago

I am calling a c# function from WASM that should return an unsigned int or long, but for some reason Wasmtime throws an exception at runtime. Signed int and long work fine.

martindevans commented 1 year ago

Wasm itself only supports signed number types (see here) and wasmtime-dotnet support the same set of number types (see here).

viperscape commented 1 year ago

Ah I see, apologies! I was compiling from assemblyscript and assumed it has similar type support. Thanks

martindevans commented 1 year ago

According to the AssemblyScript docs (here) the u32 and u64 types in AssemblyScript become i32 and i64 in WebAssembly.