Not sure if this is the right place to ask for help, sorry.

I am using 
global->Set(String::NewFromUtf8(isolate, "print", NewStringType::kNormal). 
ToLocalChecked(), FunctionTemplate::New(isolate, V8Instance::js_print));
to create a print() function in JS from the following function:
static void js_print(const v8::FunctionCallbackInfo<v8::Value> &args);
Implementation:
void V8Instance::js_print(const v8::FunctionCallbackInfo<v8::Value> &args) {
    for (int i = 0; i < args.Length(); i++) {
        v8::HandleScope handle_scope(args.GetIsolate());
        v8::String::Utf8Value str(args[i]);
        std::cout << *str << std::endl;
    }
    std::cout << std::endl;
}

As you may be able to tell, both of these are happening inside a class, 
V8Instance. This works fine, but I have to make js_print a static function to 
use it in FunctionTemplate::New. 
My problem is that I need access to a variable which is a non-static member of 
V8Instance within the js_print function. Is there a way I can either: 


   - Use js_print as a non-static class member function
   - Pass a reference or pointer to my class variable to js_print such that 
   is available whenever it is called 


Thanks for any help in advance. :)

-- 
-- 
v8-users mailing list
[email protected]
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 [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to