Reputation: 11561
I'm trying to write a program for which I would like to use some external C++ libraries in Haxe. I can't really figure it out since the official documentation is old (http://old.haxe.org/doc/cpp/ffi) and I'm not familiar with C++ either.
So how do you do that in Haxe? I suppose I'll need to install hxcpp
via haxelib
, but that's about as much as I know.
Upvotes: 3
Views: 2089
Reputation: 3237
For a start, check out C++ Magic by Hugh Sanderson. Much of the mentioned Compiler Metadata in that talk can be found at the Built-in Compiler Metadata page in the Haxe Manual.
He then talks briefly about metadata magic. He provides metadata for classes and functions. For classes you have the following:
@:headerClassCode(...) which injects member variables and inline functions. @:headerCode(...) which includes external headers. @:headerNamespaceCode(...) which allows you to add to the global namespace. @:cppFileCode(...) which allows you to include external headers only in C++ files. @:cppNamespaceCode(...) which implements static variables. @:buildXml(...) which allows you to add to the build.xml file.
For function metadata you get the following:
@:functionCode(...) @:functionTailCode(...)
Hugh states these are largely redundant as you should use untyped __cpp_(...) instead.
Upvotes: 2