dotnet-wasi-sdk icon indicating copy to clipboard operation
dotnet-wasi-sdk copied to clipboard

Exporting functions

Open eadgbear opened this issue 1 year ago • 0 comments

I'm trying to write a module that exports a function so that it's callable from another runtime. I've tried using UnmanagedCallersOnly, which I've seen be usable in other runtimes.

using System.Runtime.InteropServices;
using Extism;

[UnmanagedCallersOnly(EntryPoint = "add_two")]
static int add_two() {
    
    return 0;
}

I seem to only get the following exported functions:

file format wasm 0x1

Section Details:

Export[6]:
 - memory[0] -> "memory"
 - global[1] -> "__heap_base"
 - global[2] -> "__data_end"
 - func[7882] <_start> -> "_start"
 - func[7883] <free> -> "free"
 - func[7884] <malloc> -> "malloc"

Is this possible to accomplish with this SDK?

eadgbear avatar May 26 '24 05:05 eadgbear