You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
are also more subtly wrong and won't compile, failing with this error:
error: no viable conversion from 'Local<v8::Context>' to 'v8::Persistent<v8::Context>'
and there are a number of other compile errors, too.
The fixes that I've seen so far are (to the best of my memory):
Mark it as Local instead of Persistent.
Call context->enter() so that the context doesn't go away when it goes out of scope.
In at least one spot, remove an extraneous "v8::" (v8::Context::v8::New).
Add ->ToLocalChecked() pretty much everywhere a string gets constructed.
Additionally, it would be enormously useful if the Hello World sample were just slightly more complete so that it is more helpful for people trying to embed V8 — specifically:
Move the code that creates the context into a separate function so that we can see a real-world example where the context and isolate go out of lexical scope.
Call isolate->enter() so that the isolate doesn't go away.
Call context->enter() so that the context doesn't go away.
These small changes would have saved me many hours of swearing trying to figure out why a seemingly simple bit of code was segfaulting, and trying in vain to find ways to convert a Local handle to a Persistent handle and back.
The text was updated successfully, but these errors were encountered:
The doc in question is here:
This line:
is quite obviously wrong, because the extra "v8::" doesn't belong, though the fix for part of that is obvious.
But this line and the line above:
are also more subtly wrong and won't compile, failing with this error:
and there are a number of other compile errors, too.
The fixes that I've seen so far are (to the best of my memory):
Additionally, it would be enormously useful if the Hello World sample were just slightly more complete so that it is more helpful for people trying to embed V8 — specifically:
These small changes would have saved me many hours of swearing trying to figure out why a seemingly simple bit of code was segfaulting, and trying in vain to find ways to convert a Local handle to a Persistent handle and back.
The text was updated successfully, but these errors were encountered: