how to interface c 2b 2b in haxe

Solutions on MaxInterview for how to interface c 2b 2b in haxe by the best coders in the world

showing results for - "how to interface c 2b 2b in haxe"
Lennart
04 Apr 2020
1Im not exactly sure how this works but it do....
2  
3 Haxe file:
4
5
6@:include("helloWorld.cpp")
7
8@:native("cppClass") 
9extern class CppClass {
10    @:native("cppClass::helloFromCpp") static public function helloFromCpp():Void;
11}
12
13
14
15class Main {
16    static public function main() {
17        CppClass.helloFromCpp();
18    }
19}
20
21
22
23
24CPP file ( called helloWorld.cpp):
25#include <iostream>
26class Geeks 
27{ 
28    public: 
29 		static helloFromCpp(){
30         std::cout << "hello from cpp!"; 
31        }
32      
33}