Zero C# | C# without a runtime, from Linux to a 386


The hello-world sample, unchanged, built for each target. Each build is checked by the same test suite, which requires the same output everywhere.

$ ./build.sh Minimal
$ ./run.sh Minimal
Hello from zero-mode!
$ wc -c bin/Minimal
39848 bin/Minimal

Linux, x64 or arm64

A native program that needs only the C library. On macOS it builds and runs in a container.

$ ./build.sh --mac Minimal
$ bin/mac/Minimal
Hello from zero-mode!
$ wc -c bin/mac/Minimal
64728 bin/mac/Minimal

macOS on Apple Silicon

A native Mac program: bflat compiles it, the Mac’s own clang links it. No container to run it.

$ ./build.sh --win Minimal
$ ./run.sh --win Minimal
Hello from zero-mode!
$ wc -c bin/win/Minimal.exe
10752 bin/win/Minimal.exe

Windows x64

A console program on Windows’ own C library, built from Linux or macOS. Tested under Wine.

$ ./build.sh --wasm Minimal
$ ./run.sh --wasm Minimal
Hello from zero-mode!
$ wc -c bin/wasm/Minimal.wasm
15833 bin/wasm/Minimal.wasm

WebAssembly

A WASI module, through NativeAOT-LLVM. Runs under wasmtime.

C:>D:
D:>PROGRAM
Hello from zero-mode!

D:>DIR PROGRAM.EXE
PROGRAM  EXE     16,384

D:>

DOS on a 386

The same bitcode compiled for a 386, run by the HX DOS extender. Tested on Bochs’s i386 model.



Source link