Answers for "how to interface c++ in haxe"

C++
2

how to interface c++ in haxe

Im not exactly sure how this works but it do....
  
 Haxe file:


@:include("helloWorld.cpp")

@:native("cppClass") 
extern class CppClass {
    @:native("cppClass::helloFromCpp") static public function helloFromCpp():Void;
}



class Main {
    static public function main() {
        CppClass.helloFromCpp();
    }
}




CPP file ( called helloWorld.cpp):
#include <iostream>
class Geeks 
{ 
    public: 
 		static helloFromCpp(){
         std::cout << "hello from cpp!"; 
        }
      
}
Posted by: Guest on July-17-2021

Browse Popular Code Answers by Language