Compile a "freestanding" WASM binary #102427
-
So, here's a fun one: I'm looking to build a WASM binary, but one that doesn't use WASI or any JS interop. I'm doing some weird low-level stuff with this - the details aren't important - but I'm looking to do something like publish a class library that exports an |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 1 reply
-
You need to use NativeAOT-LLVM in the lab repo: https://github.com/dotnet/runtimelab/tree/feature/NativeAOT-LLVM/samples/NativeLibrary |
Beta Was this translation helpful? Give feedback.
-
This is what WASI (or In both cases linker will be run removing unused bits of standard library. |
Beta Was this translation helpful? Give feedback.
I will add that if you want something truly "freestanding", i. e. no WASI imports in the final binary - you mention "one that doesn't use WASI", this would effectively require creating your own flavor of .NET runtime. It is possible, e. g. https://github.com/MichalStrehovsky/zerosharp, but you will be largely on your own.