Hey, it's me again. I'm trying to use a global JavaScript file with internal definitions from a game engine. So far so good, but I need to get one of those constructors defined in the JavaScript to create a new object in C++ land.
What I tried is something like this: v8::Local<v8::Context> ctx = p_isolate->GetCurrentContext(); v8::Local<v8::Function> constructor = v8::Local<v8::Function>::Cast(ctx-> Global()->Get( v8::String::NewFromUtf8(p_isolate, "Vector2"))); v8::Local<v8::Value> cargs[] = { v8::Number::New(p_isolate, vec.x), v8:: Number::New(p_isolate, vec.y) }; v8::Local<v8::Object> instance = v8::Local<v8::Object>::Cast(constructor-> CallAsConstructor(2, cargs)); However, this give an error as it can't find the Vector2 constructor. I can use the constructor normally in JavaScript land. If I make the Vector2 constructor as a C++ function, this code works perfectly. However, I believe it has a better performance to reimplement those core types in JS than to keep passing around an object and calling C++ functions with a bunch of handles (I might be wrong though). This would also mitigate the memory management overhead, I think, which I haven't yet got into. -- -- 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.