Status: New
Owner: ----

New issue 2178 by [email protected]: segmentation fault when v8 embedded in c++
http://code.google.com/p/v8/issues/detail?id=2178

Tried to run Js fns embedding v8 in c++.

#include <v8.h>

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 = 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<String> source = String::New("(function () { .result = (window).uistyle = light; return .result; })");

  // Compile the source code.
  Handle<Script> script = Script::Compile(source);

  // Run the script to get the result.
  Handle<Value> result = script->Run();

  // Dispose the persistent context.
  context.Dispose();

  // Convert the result to an ASCII string and print it.
  String::AsciiValue ascii(result);
  printf("%s\n", *ascii);
  return 0;
}

returns a segmentation fault and 2)there also is parsing problem when the function embedded contains string with quotes

--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev

Reply via email to