HashLink

HashLink is a virtual machine for Haxe

Compile

HashLink bytecode can be produced by using Haxe compiler (requires Haxe 3.4+)

haxe -hl output.hl -main MyApp

Run

HashLink bytecode can be run using HL/JIT virtual machine.

hl output.hl

Dual compilation

HashLink bytecode can be either run through HL/JIT virtual machine or converted to C with HL/C:

haxe -hl out/main.c -main MyApp
gcc -O3 -o myapp -std=c11 -I out out/main.c -Lhl [/path/to/required.hdll]

Features

HashLink runtime includes the following features:

Libraries

While the standard HL runtime provides support for Haxe standard library, HashLink also provides several libraries that can optionally be used to build HL-specific applications.

FMT Library

Provide some binary format support:

  • inflate/deflate ZLIB compression
  • JPG decoding
  • Image scaling/resampling
  • ... more to come

UI Library

Provide some OS UI operations:

  • message/alert box
  • scrollable text log with custom buttons
  • async timer
  • (only supported on Windows for now)

SDL Library

Support for the popular SDL framework:

  • window creation
  • mouse and keyboard events
  • full OpenGL 3.2+ API
  • game controllers
  • native cursors

Performance

HashLink uses advanced optimizations to increase Haxe performance:

Initial benchmark shows that HL/JIT outperforms Adobe AIR and Node/V8 in many cases. Many room for performance improvement exists in HL/JIT to bring it as much near as HL/C as possible.

Download

HashLink can be obtained using one of the following:

Documentation

HashLink documentation can be accessed using:

Case Study: Northgard

Northgard is an upcoming 3D game by ShiroGames.

Northgard screenshot

Initially developed in Haxe with Adobe AIR, it now runs with HL and HLSDL library with the same performance.

  • The code consists in ~1200 classes containing ~11000 methods.
  • Timing has been measured on a low end Intel Q6600 @2.4 Ghz
  • Whole project recompilation takes 18.2 seconds
  • Recompilation with no change takes 2.4 seconds (using compilation server)
  • Recompilation with partial changes takes 5.8 seconds
  • Memory usage has been reduced from 900MB to 700MB