V8编程详解
这里选用了官方文档的一个非常简洁的HelloWorld.cc,代码如下:
#include using namespace v8;
int main(int argc, char* argv[]) {// Create a stack-allocated handle scope.HandleScope handle_scope;// Create a new context.Persistent context = Context::New();// Enter the created context for compiling and// running the hello world script.Context::Scope context_scope(context);// Create a string containing the JavaScript source code.Handle source = String::New("'Hello' + ', World!'");// Compile the source code.Handle
