x2f
x2f

Reputation: 185

How to obtain haxe compiler version at runtime

I would like to display the haxe compiler version on screen. Something like: var ver = haxe.version; // does not exist

Command line "haxe -version" displays the version (3.2.1 in my case).

Checking the haxe source on github, it appears the compiler version is set in the compiler program main, and does not seem to be accessible from a Haxe program.

Any idea how to do this? A macro maybe?

Upvotes: 2

Views: 585

Answers (1)

Justo Delgado
Justo Delgado

Reputation: 544

You can get the haxe version or the value of any define with:

haxe.macro.Compiler.getDefine("haxe_ver");

http://try-haxe.mrcdk.com/#ABb7a

EDIT:

You'll find haxe-ver in there.

Upvotes: 5

Related Questions