Using Haxe from C++ and being careful with the GC

I am writing a library in Haxe that I would like to use from C++. What do I need do to C++ side with references I get back from Haxe method calls to be sure the GC knows they are still live?

1 Like

Thanks for the link to my project!! But maybe not what this is what this person is looking for. :sweat_smile:

It’s pretty undocumented, but there are some resources. I’d recommend reading this article and the ones before it (might be out of date??): hxcpp-guide/work-in-progress/build/ at master · snowkit/hxcpp-guide · GitHub

I’d also recommend studying HxGodot, which generates a C++ binary that can have its functions called arbitrarily, but might have to dig through it.

Sorry for this, I tought that RoBBoR Made that library for that exact reason.

Altough I’ve never mixed haxe and CPP, I wonder ifs its possible to allocate a global vector<int> with bohem from CPP, and store pointers to the objects retrived from haxe, immediatly when recived. and so trick bohem that the pointer is still reachable, and manually remove it when you want to free it.