Yes, the examples are horribly written and hard to understand. And I don't believe any of them covered this:
// get the function v8::Local<v8::Object> global = context->Global(); v8::Local<v8::Value> function_value1 = global->Get(v8::String::NewFromUtf8(isolate, "StartNamespace")); v8::Local<v8::Object> a = v8::Local<v8::Object>::Cast(function_value1); v8::Local<v8::Value> function_value2 = a->Get(v8::String::NewFromUtf8(isolate, "cppTalkTo")); v8::Local<v8::Function> function1 = v8::Local<v8::Function>::Cast(function_value2); // call it v8::Local<v8::Value> js_result1; js_result1 = function1->Call(context, global, 0, nullptr).ToLocalChecked(); Unless there is a better way, please consider my original post answered. On Wednesday, June 6, 2018 at 3:07:33 AM UTC-7, Ben Noordhuis wrote: > > On Wed, Jun 6, 2018 at 11:42 AM, Joe Smack <messi...@gmail.com > <javascript:>> wrote: > > Let's say you compile and run code: > > > > var StartNamespace = > > { > > cppTalkTo: function () { > > // some code > > } > > }; > > StartNamespace.init(); > > > > After you compile and run the above code how could you call cppTalkTo > from > > C++? Whats the C++ functions for that? > > > > > > Basically I want to: > > v8::Script::Run > > v8::Script::Compile > > At this point how do i get the cppTalkTo v8::Handle<FunctionTemplate> > and > > then call the function? > > Have you looked at the examples in the samples/ directory? > samples/shell.cc in particular is a good starting point. > -- -- v8-users mailing list v8-users@googlegroups.com http://groups.google.com/group/v8-users --- You received this message because you are subscribed to the Google Groups "v8-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to v8-users+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.