I've just found the v8-users group which seems more appropriate for this question.
On Feb 19, 5:35 pm, "[email protected]" <[email protected]> wrote: > Hello v8-dev, > > I'm working on a Chrome plugin that uses a separate context for V8 for > several entities. I've been using the sample shell.cc as an example > of how to bind a top level function to a C++ method and have read > through the embedder's guide. Here's what I have so far: > > MyClass::init() { > > v8::HandleScope handle_scope; // For allocation of local handles. > > // Create a template for the global object. > v8::Handle<v8::ObjectTemplate> global_template = > v8::ObjectTemplate::New(); > > // Bind the global '__hLoad' function to the C++ Load callback. > global_template->Set(v8::String::New("__hLoad"), > v8::FunctionTemplate::New(&MyClass::Load)); > ... > > } > > // This method is declared static > v8::Handle<v8::Value> MyClass::Load(const v8::Arguments& args) { > ... > return v8::Undefined(); > > } > > This works fine - My JavaScript methods can call __hLoad() and > MyClass::Load() is invoked. However, my question is, how do I get the > instance pointer of type MyClass from init() into the MyClass::Load > static method? The examples in the docs don't seem to apply (I've > gotten many crashes trying to work it out.) > > -Eric. --~--~---------~--~----~------------~-------~--~----~ v8-dev mailing list [email protected] http://groups.google.com/group/v8-dev -~----------~----~----~----~------~----~------~--~---
