Hi I created a firebreath project. I added this methods to the default generated code:
In the application API header file (MYAppAPI.h):
FB_JSAPI_EVENT(bgp, 3, (const FB::variant&, bool, int));
std::string bgp(std::string& val);
In the application API source file (MAppAPI.mm I am using objective-c):
registerMethod("bgp", make_method(this, &MyAppAPI::bgp));
std::string MyAppAPI::bgp(std::string& val){...}
But when I build the code, I am getting this error:
…firebreath/src/ScriptingCore/MethodConverter.h:115: error: invalid initialization of non-const reference of type ‘std::string&’ from a temporary of type ‘std::basic_string, std::allocator >’
Any ideas?
that should read:
note the const. You can’t pass things by reference into a JS function, so it won’t let you pass a non-const reference.