Open lewing opened 2 months ago
Tagging subscribers to this area: @directhex, @matouskozak See info in area-owners.md if you want to be subscribed.
Tagging subscribers to 'arch-wasm': @lewing See info in area-owners.md if you want to be subscribed.
cc @kg
I don't really know what to make of this since i know nothing about WIT and very little about WASI. But if someone wants help investigating it they can feel free to tag me in to help them. To me it looks like unsupported p/invoke scenarios?
The first two are UCO issues, for example:
typedef void (*WasmInterpEntrySig_4) (int*, int*);
__attribute__((export_name("test:dep/test@0.1.0#x")))
float test_3A_dep_2F_test_40_0_1_0_23_x () {
float res;
initialize_runtime();
if (!(WasmInterpEntrySig_4)wasm_native_to_interp_ftndescs [4].func) {
mono_wasm_marshal_get_managed_wrapper ("csharp-wasm","FooWorld.wit.exports.test.dep.v0_1_0", "TestInterop", "wasmExportX", 0);
}
((WasmInterpEntrySig_4)wasm_native_to_interp_ftndescs [4].func) ((int*)&res, wasm_native_to_interp_ftndescs [4].arg);
return res;
}
[UnmanagedCallersOnly(EntryPoint = "test:dep/test@0.1.0#x")]
public static unsafe float wasmExportX() {
float ret;
ret = TestImpl.X();
return ret;
}
looks like it isn't finding the wrapper in mono_wasm_marshal_get_managed_wrapper
yeah the lookup logic is still too simple and there are collisions in the function lookup
I think #107113 handles (will retest once it lands) the method resolution in every important case, there are some corner cases around trimmed assemblies with overloaded methods that it doesn't address (but could do slightly better with when EntryPoint is defined). And #107194 will allow us to use LinkerArg in wit-bindgen.
Using https://github.com/bytecodealliance/wit-bindgen/pull/958 to run
cargo test -p wit-bindgen-cli --no-default-features -F csharp-mono
we see the following errors on mono