How to use C/C++ lib in Kha projects?


I spent a lot of time to understand Haxe and Kha projects are a little be different :slight_smile: .

I found this:

I want call the prebuilt TensorFlow C Lib (windows 10, x86/64bit)
I used the lastest Kha (with Haxe 4.0 RC05) :

 .\Kha\make  'windows-hl' --to build
Using Kha from D:\Projets\repositories\Tensorflow.Kha\Kha
Creating Kha project.
Compiling shader 1 of 8 (painter-colored.frag.glsl).
Compiling shader 2 of 8 (painter-colored.vert.glsl).
Compiling shader 3 of 8 (painter-image.frag.glsl).
Compiling shader 4 of 8 (painter-image.vert.glsl).
Compiling shader 5 of 8 (painter-text.frag.glsl).
Compiling shader 6 of 8 (painter-video.frag.glsl).
Compiling shader 7 of 8 (painter-text.vert.glsl).
Compiling shader 8 of 8 (painter-video.vert.glsl).
Invalid_argument("index out of bounds")

Haxe compiler error.

You can try the challenge ;), here:

Bonus: You can use Tensorflow sources directly.



My Basicia project uses this lib, but I want to try with a native lib!
Everything doesn’t run in Javascript Runtime :slight_smile: .


You could try compiling it to wasm and then call func from it. See:

Haxe is a transpiler (to C++, javascript, python, C#, Java …) and WASM is javascript technology :exploding_head: !

For instance the armory3d/haxebullet project use multi-binding JS and HLink/C++.

About this project, I haven’t tried webidl tool yet : it transforms C/C++ sources to multi-binding JS(Wasm)+HLink/C++.

I think we have to support Javascript and C++ bindings for the success of Armory3D .
We can’t be run all games only in javascript process!