我想设置一个Handle<Value>
的一个数组。我是 v8 的初学者,我找不到如何设置它
例如,当我这样做时:
Persistent<Context> fcontext
Handle<Value> Arr = Array::New(0);
Persistent<Function> Func;
Handle<Value> result = Func->Call(fcontext->Global(), 0, Arr);
我收到此错误:
error C2664: 'v8::Function::Call' : cannot convert parameter 3 from 'v8::Handle<T>' to 'v8::Handle<T> []'
1> with
1> [
1> T=v8::Value
1> ]
如何制作 Handle<Value>
具有 1 个元素的数组?
最佳答案
const unsigned argc = 1;
Local<Value> argv[argc] = { Local<Value>::New(String::New("Hello World!")) };
func->Call(Context::GetCurrent()->Global(), argc, argv);
更多例子:
关于c++ - v8 设置 Handle<Value> 数组 howto?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10283351/