12.8.1 Getting started with Haxe/C

Haxe can be used as a language for .NET platform through its C# target. Let's make a simple program using .NET Console class:

class Main {
  static public function main():Void {
    trace("Hello World");
  }
}

To compile Haxe to C# we need two obvious prerequisites installed:

After that we can compile to C# using the -cs option from either the command line or an hxml-file:

haxe -cs out -main Main

The compiler will output C# sources into out/src folder, then call C# compiler to build Main.exe file into out/bin folder.

More information

Take the Haxe Survey!