Provider | Branch | Build |
---|---|---|
AppVeyor | master | |
AppVeyor | devel | |
-
IL2C is a translator (transpiler) for ECMA-335 CIL/MSIL to C language.
-
We're aiming for:
- Better predictability for runtime costs, better human readability for the IL2C translated C source code.
- Very tiny footprint requirements, we are thinking about how fit between tiny embedded system and large system with many resources.
- Better code/runtime portability, minimum requirements are only C99 compiler.
- Better interoperabilities for exist C libraries, we can use standard .NET interop technics (likely P/Invoke.)
- Contains seamless building system for major C toolkits, for example: CMake system, Arduino IDE, VC++ ...
Original C# source code:
public static class HelloWorld
{
public static void Main()
{
Console.WriteLine("Hello world with IL2C!");
}
}
Translated to C source code (all comments are stripped):
IL2C_CONST_STRING(string0__, L"Hello world with IL2C!");
void HelloWorld_Main()
{
struct
{
uint8_t objRefCount__;
uint8_t objRefRefCount__;
IL2C_EXECUTION_FRAME* pNext__;
System_String* stack0_0__;
} frame__ = { 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 and other sample translation results (contains complex results), see this page.
The IL2C current status is experimental. Contributions are welcome but there's nothing the official guide documents. This is first step for use the IL2C:
- Open the il2c.sln by Visual Studio 2017. Your environment requires enabling the C#, VC++ and NUnit3 vsix addin.
- Build with "Debug - AnyCPU" configuration.
- If didn't show any errors, kick starts unit test at the Test Explorer (Run All).
- Unit tests need long time for first time execution. These tests are running with the gcc by automated downloads mingw platform.
- All test passed, you are ready to hacks!
- You have to know the unit tests compared and verified results both executed on the .NET CLR and the gcc compiled native code.
- I asked for you have to see in "tests/IL2C.Core.Test.Target project". It has a lot of unit test code. And if unit tests are success, you can find translated results in "tests/IL2C.Core.Test.Fixture project" subfolder "bin/Debug/net462."
- If you know the CI engineering, you can get more information from the "appveyor.yml" file.
- Currently IL2C contains the VC++ project file in the folder because it's better debugging mates. The "IL2C.Runtime.vcxproj" project file DOESN'T REQUIRE for any building (manually and CI buildings.)
- If you wanna the IL2C internals, try to read Making archive IL2C #6-55: dotNET 600 2018 session slide
Issue | Status | Milestone |
---|---|---|
Value types | Partial supported | M3 |
Class types | Partial supported | |
Managed reference | Partial supported | M3 |
Unmanaged pointer | ||
Enum types | Partial supported | |
Delegate types | Partial supported | |
Interface types | Partial supported | |
Nested types | ||
Class inherits | Partial supported | |
Interface implements | Partial supported | |
Array types | Partial supported | |
Multi dimensional array types | ||
Closed generic types | ||
Open generic types | (not support) | - |
Issue | Status | Milestone |
---|---|---|
Static field | Partial supported | M3 |
Instance field | Partial supported | M3 |
Static method | Partial supported | M3 |
Instance method | Partial supported | M3 |
Virtual method (class) | Supported | |
Virtual method (interface) | Partial supported | |
Interop method (extern static) | Partial supported | |
Internal method (internal call) | ||
Constructor | Partial supported | |
Constructor (ValueType) | Partial supported | M3 |
Type initializer | ||
Static property | ||
Instance property | ||
Static event | ||
Instance event |
Issue | Status | Milestone |
---|---|---|
Value type scopes | Partial supported | M3 |
Class type scopes | Partial supported | |
Enum type scopes | ||
Delegate type scopes | ||
Interface type scopes | Partial supported | |
Nested type scopes | ||
Field scopes | Partial supported | M3 |
Method scopes | Partial supported | M3 |
Property scopes | ||
Event scopes | ||
Can handle reflection | (not support) | - |
Issue | Status | Milestone |
---|---|---|
Referenced instance handler | Partial supported | |
Value type boxed instance handler | Partial supported | |
Collect unused instance (GC) | Partial supported | |
Heap compaction (GC) | ||
Exception throw and handles | Partial supported | |
Async exception throws | Partial supported | |
Monitor lock features | ||
Platform invoke (P/Invoke) | Partial supported | |
Can handle unsafe pointers | ||
Can handle marshaling features (Marshal) |
Issue | Status | Milestone |
---|---|---|
Basic commandline driver | Partial supported | M2 |
MSBuild (old/Task handler) | ||
MSBuild (new/.NET Core CLI) | ||
Platform independent core library | ||
Translator platform on .NET 4.5 | Supported | M1 |
Translator platform on .NET Core 1 | (not support) | - |
Translator platform on .NET Core 2 | Supported | |
Translator platform on mono | ||
Support C99 compilers | Supported | M1 |
Support non C99 (ANSI) compilers | Supported | |
Support better C code output via C++ symbol declarations | ||
Support continuous integrations | Partial supported |
Under Apache v2.
-
Public YouTube recorded videos: "Making archive IL2C play list"
- "How to create IL2C or same tool of IL2CPP? This video contains pure design process through concept and details."
-
Making archive IL2C #6-55: dotNET 600 2018 session slide
- I'm asked at the dotNET 600 2018 conference session.
- It slide is mostly covered informations about the IL2C internals in English.
-
Polish notation calculator project for IL2C proof of concept
-
Center CLR video letter: "Tested IL2C on micro:bit and arduino platform #8"
-
Public conference session video: "Making archive IL2C #6-28 at .NET Conf 2017 Tokyo"
-
Milestone 2+ informations included the book of "Extensive Xamarin - Techbook Fest part 3"
-
Public conference session: "Making archive IL2C #6-51 at .NET 600"
-
Public conference session: "How to make the calculator at .NET Fringe Japan 2018 / Making archive IL2C #6-52"
-
Public conference session: "Making archive IL2C #6-53 at MVP Summit F# Meetup / SEATTLE F# USERS GROUP"
-
Public conference session: "Making archive IL2C #6-54 at MVP SUMMIT – VS HACKATHON"
-
#6-6: Near milestones
-
#6-14: Data flow analysis
-
Milestone 1: Tested on VC++ and we checked how C compiler's optimizer work.
-
#6-48: How works mark-and-sweep garbage collection on translated code.
-
How to do overload/override/virtual method symbol calculus.
-
How to translate exception handlers when combined the local unwind and global unwind.
- We are thinking about at Center CLR Try! development meetup (11/10/2018, Japanese)
-
This is the strcuture graph for the exection-frame and exception-frame.