#include "common.h"
#include <hx/CFFI.h>
#ifndef CLASS_H
#define CLASS_H
class MY_LIBRARY_PUBLIC Point
{
int x,y;
public:
MY_LIBRARY_PUBLIC void set_points(int,int);
MY_LIBRARY_PUBLIC int getX();
MY_LIBRARY_PUBLIC int getY();
};
class MY_LIBRARY_PUBLIC Rectangle {
int width, height;
value *cb;
public:
MY_LIBRARY_PUBLIC void set_values (int,int);
MY_LIBRARY_PUBLIC void set_point_values (Point *p);
MY_LIBRARY_PUBLIC int area(void);
MY_LIBRARY_PUBLIC void callBack(value);
};
#endif
CODE FROM CPP
void Rectangle::callBack(value f)
{
cb = alloc_root();
*cb=f;
}
//@:structAccess
@:include("Rectangle.h")
@:native("Rectangle*")
@:keep
@:native("cpp::Reference")
extern class Rectangle
{
public function set_values(w : Int, h : Int) : Void;
public function set_point_values(p:Point) : Void;
@navtive("area")public function area() : Int;
public function callBack(f:Point->Void):Void;
@:native("new Rectangle") public static function create() : Rectangle;
}
@:include("Rectangle.h")
@:native("Point*")
@:keep
@:native("cpp::Reference")
extern class Point
{
public function set_points(w : Int, h : Int) : Void;
public function getX() : Int;
public function getY() : Int;
@:native("new Point") public static function create() : Point;
}
public function Callback(p:Int):Void {
}
public function new () {
super ();
//Math_extension.init();
var rec = Rectangle.create();
rec.callBack(Callback);
Error
./src/Main.cpp: In member function 'void Main_obj::__construct()':
./src/Main.cpp:27:49: error: conversion from 'Dynamic' to 'value {aka _value*}' is ambiguous
./src/Main.cpp:27:49: note: candidates are:
/Users/3psoft/lib/haxelib/hxcpp/3,3,49/include/Dynamic.h:72:11: note: Dynamic::operator cpp::UInt64() const <near match>
/Users/3psoft/lib/haxelib/hxcpp/3,3,49/include/Dynamic.h:72:11: note: no known conversion for implicit 'this' parameter from 'cpp::UInt64 {aka long long unsigned int}' to 'value {aka _value*}'
/Users/3psoft/lib/haxelib/hxcpp/3,3,49/include/Dynamic.h:71:11: note: Dynamic::operator cpp::Int64() const <near match>
/Users/3psoft/lib/haxelib/hxcpp/3,3,49/include/Dynamic.h:71:11: note: no known conversion for implicit 'this' parameter from 'cpp::Int64 {aka long long int}' to 'value {aka _value*}'
/Users/3psoft/lib/haxelib/hxcpp/3,3,49/include/Dynamic.h:69:11: note: Dynamic::operator signed char() const <near match>
/Users/3psoft/lib/haxelib/hxcpp/3,3,49/include/Dynamic.h:69:11: note: no known conversion for implicit 'this' parameter from 'signed char' to 'value {aka _value*}'
/Users/3psoft/lib/haxelib/hxcpp/3,3,49/include/Dynamic.h:68:11: note: Dynamic::operator char() const <near match>
/Users/3psoft/lib/haxelib/hxcpp/3,3,49/include/Dynamic.h:68:11: note: no known conversion for implicit 'this' parameter from 'char' to 'value {aka _value*}'
/Users/3psoft/lib/haxelib/hxcpp/3,3,49/include/Dynamic.h:67:11: note: Dynamic::operator unsigned char() const <near match>
/Users/3psoft/lib/haxelib/hxcpp/3,3,49/include/Dynamic.h:67:11: note: no known conversion for implicit 'this' parameter from 'unsigned char' to 'value {aka _value*}'
/Users/3psoft/lib/haxelib/hxcpp/3,3,49/include/Dynamic.h:66:11: note: Dynamic::operator short unsigned int() const <near match>
/Users/3psoft/lib/haxelib/hxcpp/3,3,49/include/Dynamic.h:66:11: note: no known conversion for implicit 'this' parameter from 'short unsigned int' to 'value {aka _value*}'
/Users/3psoft/lib/haxelib/hxcpp/3,3,49/include/Dynamic.h:65:11: note: Dynamic::operator short int() const <near match>
/Users/3psoft/lib/haxelib/hxcpp/3,3,49/include/Dynamic.h:65:11: note: no known conversion for implicit 'this' parameter from 'short int' to 'value {aka _value*}'
/Users/3psoft/lib/haxelib/hxcpp/3,3,49/include/Dynamic.h:64:11: note: Dynamic::operator unsigned int() const <near match>
/Users/3psoft/lib/haxelib/hxcpp/3,3,49/include/Dynamic.h:64:11: note: no known conversion for implicit 'this' parameter from 'unsigned int' to 'value {aka _value*}'
/Users/3psoft/lib/haxelib/hxcpp/3,3,49/include/Dynamic.h:63:11: note: Dynamic::operator int() const <near match>
/Users/3psoft/lib/haxelib/hxcpp/3,3,49/include/Dynamic.h:63:11: note: no known conversion for implicit 'this' parameter from 'int' to 'value {aka _value*}'
/Users/3psoft/codebase/rnd/math_extension/project/include/Rectangle.h:22:41: error: initializing argument 1 of 'void Rectangle::callBack(value)'