GitHub Hot Board

GitHub Hot Board · Arsip repositori

MichalStrehovsky/chibil

C compiler for .NET (Deskripsi berasal dari repositori itu sendiri.)

Data per October 25MichalStrehovsky

Peringkat terbaik

#227

Permata yang Terlupakan

100

Total bintang

5

Total fork

2

Hari di papan (30 hari)

Status proyekLisensi: tidak diketahuiPush terakhir: October 25Issue terbuka (termasuk PR): 8

Dikumpulkan sejak 2026-10-25; tidak diketahui = belum terkumpul

Pasang lencana di README kamu · MichalStrehovsky/chibil[![Pasang lencana di README kamu](https://git.vaiox.xyz/api/badge/MichalStrehovsky/chibil.svg)](https://git.vaiox.xyz/id/repo/MichalStrehovsky/chibil)
<a href="https://git.vaiox.xyz/id/repo/MichalStrehovsky/chibil"><img src="https://git.vaiox.xyz/api/badge/MichalStrehovsky/chibil.svg" alt="Pasang lencana di README kamu" height="20"></a>

Dokumentasi proyek

Chibil C compiler

What is chibil

Chibil is a C compiler based on chibicc rewritten in C# and updated to target .NET IL (MSIL).

It is complete enough to run DOOM (PureDOOM).

Pipeline

Chibil takes C source files and generates COFF OBJ files. These OBJ files are by default binary-compatible with OBJ files produced by the MSVC compiler in /clr mode.

To produce assemblies, one can either:

  • Use link.exe from Visual Studio; one can actually mix and match C++/CLI and chibil-produced object files, or
  • Use chilink (-fuse-ld=chilink), a managed code linker from this repo

If you use link.exe, the output will be a mixed-mode assembly that only works on Windows.

If you use chilink, the output will be a pure IL assembly. Extra flags to chibil might be needed to generate output that chilink can convert to pure IL; this mode and experience around it is under development.

Note that even though the output is pure IL, the output is likely still platform dependent, especially if you compiled against any platform-dependent header files. At minimum you'll run into issues with pointer size (C compilation requires a pointer size that is known at compile time and not much can be done about it).

Debugging

Line numbers and locals work as expected. You can step through the C code in a .NET debugger.

Standard C library

There isn't one.

There is a minimal stub of a C runtime library in the crt directory. This provides a runnable main that takes string[] of arguments and dispatches to the C-standard main with argc and argv. The produced assembly is converted to a COFF object file using the asm2obj utility and can be linked together with the C code to form something with a runnable main.

Consuming C code from .NET code

This is not complete yet. The code is generated into global namespace so if you want to consume the compiled code from elsewhere (i.e. don't intend to just run the EXE), you'll need to use reflection such as Module.GetMethod to find the methods and reflection-invoke them.

Useful tools

The tools/coffobjdumper.cs file contains a COFF OBJ dumper that dumps .NET OBJ files. It's a good complement for ILDASM (the desktop CLR ILDASM!) that can dump the .NET metadata from COFF OBJ files, but doesn't show method bodies, and dumpbin.exe that can dump various things from COFF objects, but not much in terms of .NET metadata.

Peringkat saat ini

  • 227

    Permata yang Terlupakan

    100 bintang · 5 fork · Total Star (menaik)

    Terlupakan →

Grafik 30 hari

Jumlah bintang kumulatif

Pergerakan peringkat

Tetangga peringkat di papan yang sama · Terlupakan

← Kembali ke papan