Skip to content
Tech News
← Back to articles

Chibil: A C compiler targeting .NET IL

read original get C# Programming Book → more articles
Why This Matters

Chibil is a pioneering C compiler that targets .NET Intermediate Language (IL), enabling C code to run within the .NET ecosystem. Its ability to produce compatible object files and integrate with Visual Studio tools offers new possibilities for C developers seeking to leverage .NET features and debugging capabilities. This development could influence cross-language interoperability and expand the use of C in modern software environments.

Key Takeaways

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 binary-compatible with OBJ files produced by the MSVC compiler in /clr mode. link.exe from Visual Studio is used to link the object files together and produce final executables. One can actually mix and match C++/CLI and chibil-produced object files.

Chibil will probably have its own linker later, if for no other reason, just so we don't need Windows.

Debugging

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

Standard C library

... continue reading