This issue happens when @:unreflective is used on the class and a method reference is passed to addEventListener().
The generated C++ still tries to call method_dyn, so compilation fails.
Removing @:unreflective makes the code compile, so the error only occurs when the annotation is present.
Same issue also happens with @:nativeGen
Minimal reproducible example
package;
@:unreflective
class Main {
public static function main():Void {
addEventListener("aaa", method);
}
public static function method(a:String):Void {
trace(a);
}
public static function addEventListener<T>(type:String, listener:T->Void, useCapture:Bool = false, priority:Int = 0, useWeakReference:Bool = false):Void
{
trace(type, listener, useCapture, priority, useWeakReference);
}
}
Compilation output
Error: Main.cpp
./src/Main.cpp(34): error C2039: 'method_dyn': is not a member of 'Main_obj'
include\Main.h(13): note: see declaration of 'Main_obj'
./src/Main.cpp(34): error C3861: 'method_dyn': identifier not found
This issue happens when
@:unreflectiveis used on the class and a method reference is passed to addEventListener().The generated C++ still tries to call method_dyn, so compilation fails.
Removing
@:unreflectivemakes the code compile, so the error only occurs when the annotation is present.Same issue also happens with
@:nativeGenMinimal reproducible example
Compilation output