You can also use v8::Local<v8::Context>::New(persistent).

On Wed, 30 Jan 2019, 19:48 Jakob Kummerow <[email protected] wrote:

> Persistent<T> has a function Local<T> Get(Isolate* isolate) that should
> do what you need.
>
> On Wed, Jan 30, 2019 at 9:54 AM Jeroen Ooms <[email protected]>
> wrote:
>
>> Hello!
>>
>> I maintain the V8 R package and need to port the bindings from the legacy
>> v8 3.14 api (current Debian libv8-dev) to the new 6.8 api (which will be in
>> the new Debian as part of libnode-dev).
>>
>> I am stuck on a small problem. The bindings use a persistent context
>> which is passed around as a pointer to R, and used to let the user evaluate
>> code in a given context:
>>
>>     Persistent<Context> *ctx = new Persistent<Context>(isolate,
>> Context::New(isolate, NULL, global));
>>
>> However with the new API it is not clear to me how I set the context
>> scope to such a persistent pointer. Previously I would do:
>>
>>     HandleScope handle_scope;
>>     Context::Scope context_scope(*ctx);
>>
>> However with the new API, I get a compiler error that indicates
>> that Context::Scope can only be instantiated with a Local<Context>. So it
>> is not clear to me how to evaluate code in a persistent context. Is there
>> some way to create Local<Context> from a Persistent<Context> ?
>>
>> Thank you!
>>
>>
>> --
>> --
>> v8-dev mailing list
>> [email protected]
>> http://groups.google.com/group/v8-dev
>> ---
>> You received this message because you are subscribed to the Google Groups
>> "v8-dev" 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-dev mailing list
> [email protected]
> http://groups.google.com/group/v8-dev
> ---
> You received this message because you are subscribed to the Google Groups
> "v8-dev" 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-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
--- 
You received this message because you are subscribed to the Google Groups 
"v8-dev" 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.

Reply via email to