I'm trying to convert Persistent<Context> to a void* to be passed to C, 
then back. I understand that there are a lot of changes happening to 
Persistent.

This is what I have so far, which is probably wrong:


void* isolate_new() {
Isolate *isolate = Isolate::New();
return (void*)(isolate);
}

void* context_new(void* iso) {
Isolate *isolate = (Isolate*)(iso);
isolate->Enter();
HandleScope handle_scope(isolate);
Handle<Context> context = Context::New(isolate);
Persistent<Context> pcontext(isolate, context);
isolate->Exit();
return (void*)(&Persistent<Context>::Cast(pcontext));
}

void test(void *iso, void *ctx) {
Isolate *isolate = (Isolate*)(iso);
isolate->Enter();
Handle<Context> context = *(Handle<Context>*)(ctx); // Needs to be 
Persistent<Context>, but can't figure out how to get it back.

HandleScope handle_scope(isolate);
Context::Scope context_scope(context); // This needs to be 
context_scope(isolate, context) w/ Persistent

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

String::AsciiValue ascii(result);
isolate->Exit();
printf("%s\n", *ascii);
}


I'm having difficulty getting things to compile. This is the closest I was 
able to get, but it crashes. How do I do this correctly? Should I pretty 
much give up on this until all the changes are made?

Luke

-- 
-- 
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/groups/opt_out.

Reply via email to