LmCast :: Stay tuned in

Chibil: A C compiler targeting .NET IL

Recorded: May 31, 2026, 5:01 p.m.

Original Summarized

GitHub - MichalStrehovsky/chibil: C compiler for .NET · GitHub

Skip to content

Navigation Menu

Toggle navigation

Sign in

Appearance settings

PlatformAI CODE CREATIONGitHub CopilotWrite better code with AIGitHub SparkBuild and deploy intelligent appsGitHub ModelsManage and compare promptsMCP RegistryNewIntegrate external toolsDEVELOPER WORKFLOWSActionsAutomate any workflowCodespacesInstant dev environmentsIssuesPlan and track workCode ReviewManage code changesAPPLICATION SECURITYGitHub Advanced SecurityFind and fix vulnerabilitiesCode securitySecure your code as you buildSecret protectionStop leaks before they startEXPLOREWhy GitHubDocumentationBlogChangelogMarketplaceView all featuresSolutionsBY COMPANY SIZEEnterprisesSmall and medium teamsStartupsNonprofitsBY USE CASEApp ModernizationDevSecOpsDevOpsCI/CDView all use casesBY INDUSTRYHealthcareFinancial servicesManufacturingGovernmentView all industriesView all solutionsResourcesEXPLORE BY TOPICAISoftware DevelopmentDevOpsSecurityView all topicsEXPLORE BY TYPECustomer storiesEvents & webinarsEbooks & reportsBusiness insightsGitHub SkillsSUPPORT & SERVICESDocumentationCustomer supportCommunity forumTrust centerPartnersView all resourcesOpen SourceCOMMUNITYGitHub SponsorsFund open source developersPROGRAMSSecurity LabMaintainer CommunityAcceleratorGitHub StarsArchive ProgramREPOSITORIESTopicsTrendingCollectionsEnterpriseENTERPRISE SOLUTIONSEnterprise platformAI-powered developer platformAVAILABLE ADD-ONSGitHub Advanced SecurityEnterprise-grade security featuresCopilot for BusinessEnterprise-grade AI featuresPremium SupportEnterprise-grade 24/7 supportPricing

Search or jump to...

Search code, repositories, users, issues, pull requests...

Search

Clear

Search syntax tips

Provide feedback


We read every piece of feedback, and take your input very seriously.

Include my email address so I can be contacted

Cancel

Submit feedback

Saved searches

Use saved searches to filter your results more quickly

Name

Query

To see all available qualifiers, see our documentation.

Cancel

Create saved search

Sign in

Sign up

Appearance settings

Resetting focus

You signed in with another tab or window. Reload to refresh your session.
You signed out in another tab or window. Reload to refresh your session.
You switched accounts on another tab or window. Reload to refresh your session.

Dismiss alert

MichalStrehovsky

/

chibil

Public

Notifications
You must be signed in to change notification settings

Fork
0

Star
27

Code

Issues
2

Pull requests
1

Actions

Projects

Security and quality
0

Insights

Additional navigation options

Code

Issues

Pull requests

Actions

Projects

Security and quality

Insights


MichalStrehovsky/chibil

 masterBranchesTagsGo to fileCodeOpen more actions menuFolders and filesNameNameLast commit messageLast commit dateLatest commit History105 Commits105 Commits.github/workflows.github/workflows  chibilchibil  crtcrt  docsdocs  samples/doomsamples/doom  scenariosscenarios  tests/Chibil.Teststests/Chibil.Tests  toolstools  .gitignore.gitignore  .gitmodules.gitmodules  README.mdREADME.md  THIRD-PARTY-NOTICES.mdTHIRD-PARTY-NOTICES.md  View all filesRepository files navigationREADMEChibil 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
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.

About

C compiler for .NET

Resources

Readme

Uh oh!

There was an error while loading. Please reload this page.


Activity
Stars

27
stars
Watchers

0
watching
Forks

0
forks

Report repository

Releases
No releases published

Packages
0

 

 

 

Uh oh!

There was an error while loading. Please reload this page.


Contributors

Uh oh!

There was an error while loading. Please reload this page.


Languages

C#
98.5%

C
1.4%

C++
0.1%

Footer

© 2026 GitHub, Inc.

Footer navigation

Terms

Privacy

Security

Status

Community

Docs

Contact

Manage cookies

Do not share my personal information

You can’t perform that action at this time.

The chibil project is a C compiler implemented in C sharp, derived from chibicc, which is specifically updated to target .NET Intermediate Language (MSIL). The compiler is designed to be functional enough to execute applications such as PureDOOM, establishing a foundation for compiling C code within a .NET environment. The compilation pipeline involves the process of taking C source files and generating COFF OBJ files, which are made binary-compatible with OBJ files produced by the MSVC compiler when operating in /clr mode. These generated object files can then be linked using link.exe from Visual Studio to produce final executable files, offering flexibility in mixing and matching object files generated by chibil with those from C++/CLI.

Debugging capabilities are supported within the framework; the system maintains functionality for line numbers and local variables, allowing users to step through the C code using a .NET debugger. To facilitate the creation of runnable programs, chibil includes a minimal stub of a C runtime library located in the crt directory, which provides a necessary main function mechanism to dispatch to the standard C main function with argc and argv. Furthermore, assembly generated during the process is converted into COFF object files via the asm2obj utility, enabling these assembled components to be linked with the C runtime code to construct executables with a functional entry point.

Regarding the consumption of C code from .NET code, the functionality is not yet complete. Currently, the compiled code is generated into the global namespace, which presents a challenge for external consumption. To access the compiled code outside the direct execution context, methods such as reflection, specifically utilizing Module.GetMethod, are required to locate and invoke the compiled methods. Supplementary tools are provided to assist in handling the compiled output, including coffobjdumper.cs, which serves as a COFF OBJ dumper for .NET OBJ files, offering a complement to tools like ILDASM for extracting .NET metadata from COFF OBJ files, and dumpbin.exe, which can extract various attributes from COFF objects.