第10月第5天 v8

1.

brew install v8

http://www.cnblogs.com/tinyjian/archive/2017/01/17/6294352.html

http://blog.csdn.net/mydo/article/details/57436787

 

#include<v8.h>

using namespace v8;

int main(int argc, char *argv[]) {

    HandleScope handle_scope;

    Persistent<Context> context = Context::New();

    Context::Scope context_scope(context);

    Handle<String> source = String::New(" 'Hello' + ', World' ");
    
    Handle<Script> script = Script::Compile(source);
    
    Handle<Value> result = script->Run();

    context.Dispose();

    String::AsciiValue ascii(result);
    printf("%s\n", *ascii);
    
    return 0;

}

 

https://github.com/Marviel/BitRPG

posted @ 2017-07-05 08:33  lianhuaren  阅读(105)  评论(0编辑  收藏  举报