GitPedia

IL2C

IL2C - A translator for ECMA-335 CIL/MSIL to C language.

From kekyo·Updated May 27, 2026·View on GitHub·

* IL2C is a translator (transpiler) of ECMA-335 CIL/MSIL to C language. The project is written primarily in C#, distributed under the Apache License 2.0 license, first published in 2017. Key topics include: aot, arduino, c, cil, csharp.

Latest release: 0.4.230
May 11, 2022View Changelog →

IL2C - A translator for ECMA-335 CIL/MSIL to C language.

Intermediate language everywhere!

What's this?

  • IL2C is a translator (transpiler) of ECMA-335 CIL/MSIL to C language.

  • We're aiming for:

    • Better predictability of runtime costs
      Better human readability of C source code translated by IL2C.
    • Very tiny footprint requirements
      We're thinking about how to fit from large system with many resources to tiny embedded system. (KB order for the non-OSes system)
    • Better code/runtime portability
      Minimum requirement is only C99 compiler. The runtime minimum requires only the heap, CAS instructions, (POSIX) signal and setjmp/longjmp. Additional better feature is threading API (Win32, pthreads and FreeRTOS.)
    • Better interoperabilities for existed C libraries
      You can use the standard .NET interop technics (like P/Invoke.)
    • Containing seamless building systems for major C toolkits
      for example: CMake system, Arduino IDE, VC++ ...

Simple hello-world like code

Original C# source code:

csharp
public static class HelloWorld { public static void Main() { Console.WriteLine("Hello world with IL2C!"); } }

Translated to C source code (all comments are stripped):

c
IL2C_CONST_STRING(string0__, L"Hello world with IL2C!"); void HelloWorld_Main() { struct { const IL2C_EXECUTION_FRAME* pNext__; const uint16_t objRefCount__; const uint16_t valueCount__; System_String* stack0_0__; } frame__ = { NULL, 1, 0 }; il2c_link_execution_frame(&frame__); frame__.stack0_0__ = string0__; System_Console_WriteLine_10(frame__.stack0_0__); il2c_unlink_execution_frame(&frame__); return; }

View with comments / other sample translation results (contain complex results)

Getting started

IL2C current status is experimental, read a simple "Getting started" for first step.

If you need understanding deep knowledge for IL2C, see "Inside IL2C" .

Project status

Following lists are auto-generated by unit test.

Supported features (old)

Packages

Packagesmasterdevel
IL2C.BuildNuGet IL2C.BuildMyGet IL2C.Build
IL2C.InteropNuGet IL2C.InteropMyGet IL2C.Interop
IL2C.CoreNuGet IL2C.CoreMyGet IL2C.Core
IL2C.RuntimeNuGet IL2C.RuntimeMyGet IL2C.Runtime
IL2C.Runtime.msvcNuGet IL2C.Runtime.msvcMyGet IL2C.Runtime.msvc
IL2C.Runtime.Arduino(Constructing)(Constructing)

Build status

Configurationmaster
PublishAzure pipelines (.NET 4.5 / .NET Core 2.0)
DebugAzure pipelines (.NET 4.5 / .NET Core 2.0) Azure pipelines tests
ReleaseAzure pipelines (.NET 4.5 / .NET Core 2.0) Azure pipelines tests
Configurationdevel
PublishAzure pipelines (.NET 4.5 / .NET Core 2.0)
DebugAzure pipelines (.NET 4.5 / .NET Core 2.0) Azure pipelines tests<br>Build Stats
ReleaseAzure pipelines (.NET 4.5 / .NET Core 2.0) Azure pipelines tests<br>Build Stats

License

Under Apache v2.

Photos of design process

  • #6-6: Near milestones

    #6-6: Near milestones

  • #6-14: Data flow analysis

    #6-14: Data flow analysis

  • Milestone 1: Test on VC++ and check how C compiler's optimizer works.

    Milestone 1: Test on VC++ and check how C compiler's optimizer works

  • #6-48: How mark-and-sweep garbage collection works on a translated code.

    #6-48: How mark-and-sweep garbage collection works on a translated code

  • How overload/override/virtual method symbol calculus work.

    How overload/override/virtual method symbol calculus work

  • How to translate exception handlers when combined the local unwind and global unwind.

    How to translate exception handlers when combined the local unwind and global unwind

  • This is the strcuture graph for the exection-frame and exception-frame.

    This is the strcuture graph for the exection-frame and exception-frame

Contributors

Showing top 1 contributor by commit count.

View all contributors on GitHub →

This article is auto-generated from kekyo/IL2C via the GitHub API.Last fetched: 6/23/2026