COMMUNITY

Is it possible to use cppia to replace functions? I keep getting an error on a really basic attempt

I managed to get this to work somehow when trying this out, which is why I’m pursuing this. Haxe 4.1.1

class ToolCore 
{
	public static var mouse_down:Void -> Void;
	
	public function new() 
	{
		mouse_down = null_mouse_down;

		Host.runFile("./plugins/tools/TestTool.cppia");
	}
	
	public static function null_mouse_down():Void {
		trace("No Mouse Event");
	}
	
}
//this is the cppia script
class TestTool {
	static public function main() {
		ToolCore.mouse_down = () -> {trace("herpa derp"); };
	}
}

I get the error Unknown function : __hxcpp_mutex_create(0) whenever I run the cppia file. Is this not how I’m supposed to use cppia? I’d like to use it as a plugin system.

I know close to nothing about cppia, but the above code is certainly correct as far as Haxe semantics are concerned and should therefore execute just fine. That would make this a bug in cppia and the best course of action is to report it on https://github.com/HaxeFoundation/hxcpp/issues

My geom library runs unit tests with cppia on terminal without a problem ( added instructions readme for rebuilding cppia, hxcpp, in the repo etc… and it works fine for testing hxMath similar to eval ), but for the Host approach, do you perhaps need to create a socket server layer for communication?



Perhaps try the NME gitter channel occasionally Hugh is in there, and some other NME users that may use some Cppia.