You are trying to connect two things at once: an instance and a method to call on it and have it as a pointer to a function. This, unfortunately, does not work in C ++. You can only bind a pointer to a simple function or static method. Thus, you add the static method "RegisterCB" and register it as a callback:
static Handle<Value> RegisterCB(const Arguments& args); ...FunctionTemplate::New(&PluginManager::RegisterCB)...
Now where do you get pluginManagerInstance? For this purpose, most apis callback registrations in V8 have an additional βdataβ parameter that will be passed back to the callback. Also FunctionTemplate :: New. So you really want to link it like this:
...FunctionTemplate::New(&PluginManager::RegisterCB, External::Wrap(pluginManagerInstance))...
Data is then available through args.Data (), and you can delegate the actual method:
return ((PluginManager*)External::Unwrap(args.Data())->Register(args);
It might be a little easier with some macros.
mernst
source share