Is there a way in which Haxe can extern a C/C++ constructor, as mentioned in the title, or is this implicit at compile-time when using the “new” keyword?
What exactly do you mean by extern here?
If this is normal haxe code compiled to c++ then it’s not a normal constructor exactly since in haxe you can put super anywhere and extension isn’t dealt in the same way,.
Okay… so what about in the situation below:
@:include("../include/object.h")
@:native("wxObject")
extern class Object
{
public function new(?other:Object);
@:native("GetClassInfo")
public function getClassInfo():ClassInfo;
@:native("IsKindOf")
public function isKindOf(info:ClassInfo):Bool;
@:native("IsSameAs")
public function isSameAs(obj:Object):Bool;
@:native("Ref")
public function ref(obj:Object);
@:native("UnRef")
public function unRef();
@:native("UnShare")
public function unShare();
}
Oh so for an extern class.
I’ve seen things like this:
@:native("new wxObject")
public static function create () : cpp.Pointer<Object>;
@:native("~wxObject")
public function deleteMe():Void;
But nothing directly with a haxe constructor, I don’t think that’s possible.
Maybe there’s a way to use @:functionCode like this:
Wait, so you can’t do anything like extern class Event extends Object
? How is that dealt with?
I was talking about another thing sorry (the c++ code generated for a normal haxe class),
don’t worry about it that works
1 Like