maybe a rather beginner’s question, but is there a possibility to attach your own libs in Haxe?
example: I have written a calculator in C++ and in Java and don’t want to rewrite it completely in Haxe. But I want to use the function “Add(x,y)” in my Haxe code.
Is it possible to include the calculator as a library depending on the compiler.
Unfortunately I have not found any beginner-friendly guides for this.
For Java, you can just include a .jar in compilation via --java-lib. For C++… it might be quicker to rewrite it in Haxe rather than trying to figure out how C++ externs work, depending on how much code we’re talking about and how familiar you are with C++. Plus, it would work on targets other than Java and C++ then.
For C++ you can check haxe.Int64 as an example of interoperation:
AFAIK @:include generates respective instruction in the compiled c++ code. @:native specifies for the Haxe compiler which name to generate for a symbol instead of its haxe name.