On Monday, April 1, 2013 3:49:41 PM UTC+2, Stephan Beal wrote:
If i understand your question correctly, you simply need to add them to your 'globals' object. You can get the global object later (without a direct reference) with Context::GetCurrent()->Global().
That sounds really nice. I tried to use the global object to add a function template.
v8::Local<v8::Object> global = context->Global();
global->Set(v8::String::New("print"), v8::FunctionTemplate::New(Print));
The since the Global() function return an v8::Object instead of an v8::TemplateObject its Set() function is different. The code doesn't compile and the compiler error reads the following.
error C2440: '=': cannot convert from 'v8::FunctionTemplate *' to 'v8::Value *volatile'
Could you please give me an advice?
By the way, is it correct that I don't have to store any handles for context or global object as long as I am only using a single context in my application? That would be great. For now I am storing the context handle as a member, as you might see from the example.