5
我在DLL如何轉換V8 ::字符串爲const char *
static COMMANDERDLL_API int InsertCodeBar(const char* pszBuffer);
這個功能在我的節點插件我有這個功能
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);
}
當我嘗試編譯,節點GYP返回錯誤:「無法從 'V8 ::本地' 轉換參數1 '爲const char *'
如何轉換V8 ::字符串爲const char *
?