c++typesrttihaxenme

RTTI property not found for CPP targets in Haxe NME


I'm using rtti in haxe nme. It works well when targeting flash but when compiling to a cpp target I receive the following error.

error C2039: '__rtti' : is not a member of 'Class_obj'

I'm doing this...

public function doSomething(type:Class<Dynamic>):Void {
    var typeInfo:String = untyped type.__rtti;
}

I also tried...

public function doSomething <T:Infos> (type:Class<T>):Void {
    var typeInfo:String = untyped type.__rtti;
}

What should I do?


Solution

  • Make it looser! :Dynamic instead of :Class<Dynamic>

    public function doSomething(type:Dynamic):Void {
        var typeInfo:String = untyped type.__rtti;
    }