bytecodealliance / wasmtime-dotnet

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

instance.getfunction or instance.getaction does not find function with &[u8] argument #292

Closed relcodedev closed 8 months ago

relcodedev commented 8 months ago

I assume what I am doing is unsupported.

I have rust wasm with a function.

[no_mangle]

pub fn process_document(doc: &[u8]) { println!("before slice"); println!("after slice"); let _k = doc ; }

the c# code to get that function works if I change the function above to no argument or an int argument. It seems that &[u8] argument makes it not findable.

same for the instance.getfunction

work var process_document = instance.GetAction("process_document")!; var process_document = instance.GetAction("process_document")!;

doesn't find function var process_document = instance.GetAction<byte[]>("process_document")!;

I assume a byte[] in c# is a &[u8] in rust unless that is incorrect.

the wat for the function is (export "process_document" (func 14))

(func (;14;) (type 3) (param i32 i32)

also the Console.WriteLine(instance.GetFunctions().Count()); always prints out 0 (zero).

Thank you for any guidance.