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 [-L/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 binary format support:

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

UI Library

Provide 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 a 3D game created 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
  • Northgard is built using the open-source Heaps.io game engine
  • Northgard is available on Steam for PC, Mac OS X and Linux but also on consoles Nintendo Switch, PS4 and Xbox One
Edit this page