NME Native Extension Part 2 : Calling CPP methods from haxe

Much more easier than JNI methods, all you have to do is using the “cpp.Lib” class ( “neko.Lib” for neko ).

1
Lib.load( libName , primitiveName , argsCount );

LibName:
It’s the cpp library name ( without path and extension ).

PrimitiveName:
The name of the primitive defined in the ExternalInterface class.
In the next article of the tutorial we will take a look at how to define the primitive in the ExternalInterface class, which is the backbone of the native extension.

ArgsCount:
Obviously it’s the argument count used by the primitive.

This will return like for JNI, a function which can be call with the correct number of arguments.

Tags: , , , , , , ,