c++scriptinghaxehxcpp

What is cppia scripting?


I was just looking at the Change Log for Haxe 3.2.0-rc.2 and found this at the end of New features list:

cpp : inititial implementation of cppia scripting

Can anyone can tell me what this means? I can tell that it has something to do with C++, but googling this gives nothing related to programming/scripting unless you count Haxe related results.


Solution

  • Cppia (pronounced "sepia") is a new part of the C++ target for Haxe. In the most basic sense it is a "scripting" language for hxcpp which can be compiled and run without the use of a C++ compiler. Some official documentation can be found here:

    Getting started with Haxe/Cppia

    In order to compile to cppia you need to modify your hxml build file. Add a -D cppia flag to your build and change the output to have a .cppia extension. Here is an example.

    -cpp out.cppia # the cppia output file
    -main Main     # your Main.hx file
    -D cppia       # this enables cppia compilation
    

    After you do that you compile the hxml file like normal with Haxe. It will give you a file named out.cppia which can then be run through hxcpp using the command haxelib run hxcpp out.cppia. One drawback to this method is there is no way to use native extensions without building your own cppia host. So if you need to run something using OpenFL or Kha you'll have to wait until they support cppia.

    According to the information I've found it sounds like cppia runs as fast as Neko JIT. Considering the compile times are just as fast I can see this becoming a good alternative to the neko target in the future.

    Additional information can be found in slides from a talk given by the creator, Hugh Sanderson, at WWX 2015.

    http://gamehaxe.com/wwx/wwx2015.swf