Hi there, This appears to be an older example source code used with a newer version of V8. The V8 docs contain an updated example that works with current versions of the library: https://developers.google.com/v8/get_started
Daniel On Wed, Aug 27, 2014 at 6:57 PM, ahwood <[email protected]> wrote: > > 1. The example belows can not be compiled. How could I use > Persistent<Context> context, > because I try to make it in a Dll libaray port to my application, and it > will be Persistent in memory. > 2. > 3. #include <v8.h> > 4. > 5. using namespace v8; > 6. int main(int argc, char* argv[]) { > 7. > 8. // Create a stack-allocated handle scope. > 9. HandleScope handle_scope; > 10. > 11. // Create a new context. > 12. Persistent<Context> context = Context::New(); > 13. > 14. // Enter the created context for compiling and > 15. // running the hello world script. > 16. Context::Scope context_scope(context); > 17. > 18. // Create a string containing the JavaScript source code. > 19. Handle<String> source = String::New("'Hello' + ', World!'"); > 20. > 21. // Compile the source code. > 22. Handle<Script> script = Script::Compile(source); > 23. > 24. // Run the script to get the result. > 25. Handle<Value> result = script->Run(); > 26. > 27. // Dispose the persistent context. > 28. context.Dispose(); > 29. > 30. // Convert the result to an ASCII string and print it. > 31. String::AsciiValue ascii(result); > 32. printf("%s\n", *ascii); > 33. return 0; > 34. } > > -- > -- > v8-users mailing list > [email protected] > http://groups.google.com/group/v8-users > --- > You received this message because you are subscribed to the Google Groups > "v8-users" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > For more options, visit https://groups.google.com/d/optout. > -- -- v8-users mailing list [email protected] http://groups.google.com/group/v8-users --- You received this message because you are subscribed to the Google Groups "v8-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/d/optout.
