Skip to content

E024/NativeSharp

 
 

Repository files navigation

NativeSharp

Open source C# to C++ transpiler (NativeSharp, based on Cs2Cpp)

Information

NativeSharp is heavily based on Cs2Cpp.

License

Cs2Cpp is licensed under the MIT license.

Quick Start

Prerequisite: CMake, .NET 4.6, GCC 5.0+ or Microsoft Visual C++ 2015

  1. Build Project
cd Il2Native
MSBuild Il2Native.sln /p:Configuration=Debug /p:Platform="Any CPU"
  1. Build CoreLib (aka mscorlib)
cd CoreLib
MSBuild CoreLib.csproj /p:Configuration=Release /p:Platform="AnyCPU"
  1. Create a temporary folder to build projects/files
cd ..\..
mkdir playground
cd playground
  1. Generating CoreLib C++ project
..\Il2Native\Il2Native\bin\Debug\Cs2Cpp.exe ..\Il2Native\CoreLib\CoreLib.csproj
  1. Compile it
cd CoreLib
build_prerequisite_vs2015_debug.bat 
build_vs2015_debug.bat

Now you have compiled CoreLib (mscorelib)

  1. Compile HelloWorld.cs
cd ..

create file HelloWorld.cs

using System;

class X {
	public static int Main (string [] args)
	{
		Console.WriteLine ("Hello, World!");
		return 0;
	}
}
..\Il2Native\Il2Native\bin\Debug\Cs2Cpp.exe HelloWorld.cs /corelib:..\Il2Native\CoreLib\bin\Release\CoreLib.dll
cd HelloWorld
build_vs2015_release.bat

Now you have HelloWorld.exe

Releases

No releases published

Packages

No packages published

Languages

  • C# 96.8%
  • Smalltalk 2.6%
  • Other 0.6%