-
Notifications
You must be signed in to change notification settings - Fork 5.3k
Closed
Labels
arch-wasmWebAssembly architectureWebAssembly architecturearea-Codegen-Interpreter-monoin-prThere is an active PR which will close this issue when it is mergedThere is an active PR which will close this issue when it is mergedos-browserBrowser variant of arch-wasmBrowser variant of arch-wasmos-wasiRelated to WASI variant of arch-wasmRelated to WASI variant of arch-wasm
Milestone
Description
#94615 added EntryPoint support to UCO on wasm (it was missing before)
[UnmanagedCallersOnly(EntryPoint = "display_meaning")]
public static void DisplayMeaningExport(int meaning)
{
Console.WriteLine($"The meaning of life is {meaning}");
}but there is currently an issue with when invoking the export from unmanaged when there is no managed delegate pointing to it and something akin to the following workaround is required:
Intptr workaround = (IntPtr)(delegate* unmanaged<int,void>)&display_meaning; // needs to be in method loaded by interp prior to unmanaged call This is because get_native_to_interp must be called before attempting to invoke the unmanaged entry point or the call will fail. Without the call wasm_native_to_interp_ftndescs is never initialized. For the workaround to work the delegate * does not need to be reached/reachable, the interpreter simply needs to resolve the method prior to calling it from unmanaged.
knutwannheden
Metadata
Metadata
Assignees
Labels
arch-wasmWebAssembly architectureWebAssembly architecturearea-Codegen-Interpreter-monoin-prThere is an active PR which will close this issue when it is mergedThere is an active PR which will close this issue when it is mergedos-browserBrowser variant of arch-wasmBrowser variant of arch-wasmos-wasiRelated to WASI variant of arch-wasmRelated to WASI variant of arch-wasm