Hello. I use V8 to implement scripting in the program. There is such a function on JS:

__loadSubScene(name, pathToSceneDescriptor, loadPhysics, (err) => { alert('Scene was loaded!'); }); 

as well as a C ++ handler:

 void APIFunctions::__loadSubScene(const v8::FunctionCallbackInfo<v8::Value>& args) { if (args.Length() == 4) { v8::String::Utf8Value v8SceneName(args[0]); std::string name = ConvertUtils::toString(*v8SceneName); v8::String::Utf8Value v8Path(args[1]); std::string path = ConvertUtils::toString(*v8Path); v8::Local<v8::Boolean> isLoadPhysics = args[2]->ToBoolean(); v8::Handle<v8::Function> callback = v8::Handle<v8::Function>::Cast(args[3]); TLMFacade::getInstance().loadSubScene(ConvertUtils::toWstring(name), ConvertUtils::toWstring(path), isLoadPhysics->BooleanValue(), [=](void* _result) { // функция должна быть вызвана здесь }); } } 

When I call a callback from C ++, I get an error. Perhaps someone knows the rules by which to perform such actions or an example. Thank.

  • What mistake? Show the text of the error. - nick_n_a
  • JS eats IDispath well. Create a ScriptControl, and there you can add IDispath objects and a script. - nick_n_a
  • # # Fatal error in d: \ projects \ v8-nuget \ v8 \ src \ api.h, line 349 # Check failed: that == 0 || ( reinterpret_cast <v8 :: internal :: Object const *> (that)) -> IsJSReceiver (). # - Leonty Hachuev

0