2015-02-24 111 views

回答

3

要將std :: string轉換爲v8 :: Local < v8 :: String >,則不需要編譯和運行腳本。只是這樣做:

std::string sText = "whatever"; 
v8::Local<v8::String> hTextJS = v8::String::NewFromUtf8(v8::Isolate::GetCurrent(), sText.c_str()) 
+0

我得到這個錯誤:「NewFromUtf8」不是成員「V8 ::字符串」 – JaisoN 2015-02-25 04:52:26

+0

V8 ::字符串:: NewFromUtf8是最遲在https://github.com/ V8/V8 /斑點/主/包含/ v8.h。也許你有一箇舊版本?如果您使用的是較早版本,則可能只會調用v8 :: String :: New。 – 2015-02-26 23:47:00

+0

謝謝先生:) – JaisoN 2015-04-15 07:12:21