Hi
I am trying to convert my haxe apps from hashlink/weblink to haxecpp and CivetWeb
So far I’ve been successfull with:
calling from haxe/cpp initialization code.
calling from cpp handler a haxe static method.
initializing the civetweb threads with the haxe GC.
Now I am trying to kep an array of handlers and dispatch the correct handler
static var handlers=new Map<String,RequestInfo->String>();
static function respond(conn:Star<Connection>){
var handler;
var req_info=mg_get_request_info(conn);
for (k=>v in handlers){
if (req_info.request_uri.toString().startsWith(k)){
return v(req_info);
}
}
return "404 not found from haxe";
}
@:structAccess
@:native("mg_request_info")
@:include("../../civetweb/include/civetweb.h")
extern class RequestInfo {
public var request_method:cpp.ConstCharStar;
public var request_uri:cpp.ConstCharStar;
}
I receive the follwing erros that I am unable to interpret
Error: Main_Fields_.cpp
./src/_Main/Main_Fields_.cpp(46): error C2664: 'String _Main::Main_Fields__obj::main::_hx_Closure_0::_hx_run(mg_request_info)': cannot convert argument 1 from 'ELEM_' to 'mg_request_info'
with
[
ELEM_=Dynamic
]
./src/_Main/Main_Fields_.cpp(46): note: No user-defined-conversion operator available that can perform this conversion, or the operator cannot be called
./src/_Main/Main_Fields_.cpp(42): note: see declaration of '_Main::Main_Fields__obj::main::_hx_Closure_0::_hx_run'
./src/_Main/Main_Fields_.cpp(46): error C2664: 'String _Main::Main_Fields__obj::main::_hx_Closure_0::_hx_run(mg_request_info)': cannot convert argument 1 from 'const Dynamic' to 'mg_request_info'
./src/_Main/Main_Fields_.cpp(46): note: No user-defined-conversion operator available that can perform this conversion, or the operator cannot be called
./src/_Main/Main_Fields_.cpp(42): note: see declaration of '_Main::Main_Fields__obj::main::_hx_Closure_0::_hx_run'
./src/_Main/Main_Fields_.cpp(53): error C2664: 'String _Main::Main_Fields__obj::main::_hx_Closure_1::_hx_run(mg_request_info)': cannot convert argument 1 from 'ELEM_' to 'mg_request_info'
with
[
ELEM_=Dynamic
]
./src/_Main/Main_Fields_.cpp(53): note: No user-defined-conversion operator available that can perform this conversion, or the operator cannot be called
./src/_Main/Main_Fields_.cpp(49): note: see declaration of '_Main::Main_Fields__obj::main::_hx_Closure_1::_hx_run'
./src/_Main/Main_Fields_.cpp(53): error C2664: 'String _Main::Main_Fields__obj::main::_hx_Closure_1::_hx_run(mg_request_info)': cannot convert argument 1 from 'const Dynamic' to 'mg_request_info'
./src/_Main/Main_Fields_.cpp(53): note: No user-defined-conversion operator available that can perform this conversion, or the operator cannot be called
./src/_Main/Main_Fields_.cpp(49): note: see declaration of '_Main::Main_Fields__obj::main::_hx_Closure_1::_hx_run'
Error: Build failed
Can anyone point how to get past the error?
What is ELEM_ why is it dynamic?