小编Mat*_*que的帖子

如何将v8 :: String转换为const char*

我在dll中有这个功能

static COMMANDERDLL_API int InsertCodeBar(const char* pszBuffer);
Run Code Online (Sandbox Code Playgroud)

在我的节点插件我有这个功能

void InsertCodeBarWrapper(const FunctionCallbackInfo<Value>& args){
    Isolate* isolate = args.GetIsolate();

    Local<Function> cb = Local<Function>::Cast(args[1]);
    Local<String> bar = args[0]->ToString();
    const unsigned argc = 1;
    Local<Value> argv[argc] = { CSGPCommander::InsertCodeBar(bar) };
    cb->Call(isolate->GetCurrentContext()->Global(), argc, argv);
}
Run Code Online (Sandbox Code Playgroud)

当我尝试编译时,node-gyp返回错误:"无法将参数1从'v8 :: Local'转换为'const char*'

如何将v8 :: String转换为const char*?

c++ v8 node.js node-gyp node.js-addon

5
推荐指数
1
解决办法
8068
查看次数

标签 统计

c++ ×1

node-gyp ×1

node.js ×1

node.js-addon ×1

v8 ×1