Questions tagged [embedded-v8]
253 questions
0
votes
1 answer
How to demonstrate V8 Weak Pointer callback?
I'm considering using V8 as an embedded JavaScript engine for a project but I'm having trouble figuring out how to manage the lifetime of native C++ objects. This experiment was supposed to demonstrate the Weak Pointer callback.
Near the end of the…

Wyck
- 10,311
- 6
- 39
- 60
0
votes
1 answer
How to write a setter with newer V8 API?
In the V8 embedding guide in the section for accessing dynamic variables, it describes how to write a setter for a wrapped C++ object. But the documentation seems to have rotted a bit in its usage of ToInt32 compared to the current (v14.1)…

Wyck
- 10,311
- 6
- 39
- 60
0
votes
1 answer
ES6 Modules with top-level await on embedded v8
How would one make top-level await in ES6 Modules? I have gotten regultar ES6 modules to work, but I can't find anything about top-level await in ES6 modules with v8.
here is my code:
v8::Local FactoryModule(v8::Isolate* isolate,…

pitust
- 99
- 8
0
votes
1 answer
Can I get the source text of JavaScript functions in C++ callback function using google v8?
I am embeding google v8 into my C++ program. I want to get the source code of Javascript functions passed as arguments into my C++ function. For example:
function ComputePixel(nir, red, blue) {
return (nir-red)/(blue-red)
}
var layer =…

kyleqian
- 311
- 1
- 3
- 14
0
votes
1 answer
how to get the return value of a JS function from V8?
I'm currently trying to get the return value of a function that I call in JS. The following code can reproduce it (minus v8 includes)
#include "v8.h"
#include "libplatform/libplatform.h"
#include
#include
int64_t repro()
{
…

Tobias Langner
- 10,634
- 6
- 46
- 76
0
votes
1 answer
Streaming data into V8 / out of V8
I have a C++ application with an embedded V8 engine and I want to use V8 to transform data flexibly using Javascript. The amount of data is potentially large and comes from different file formats, so it is processed one record at a time. How can I…

Tobias Langner
- 10,634
- 6
- 46
- 76
0
votes
1 answer
google v8 persistent Context - script compilation crashes
I'm trying to use one global context for later executions. When the function1 is called, script returns the correct value. However when I call function2 after that, Script::Compile crashes. Function 1 is an initialization of v8 so I call it only…

Honza Bednář
- 396
- 4
- 14
0
votes
0 answers
Is there a limit for v8 embed program to create v8::Context?
In MSVC2015 release mode, my program always crash when the for loop runs in 680~685.
Below is my codes:
#include
#define _CRT_SECURE_NO_WARNINGS
#include
#include
#include "libplatform/libplatform.h"
#include…

wangfeng
- 1
- 1
0
votes
0 answers
Set an already created global js variable in c++ with v8?
I have a global variable in my js code and I'm trying to set it to a different value from c++. I've tried:
v8::Isolate* isolate = v8::Isolate::GetCurrent();
v8::Local ctx = isolate->GetCurrentContext();
v8::Local…

Alex
- 131
- 2
- 13
0
votes
1 answer
V8 : Isolate is incompatible with the embedded blob
I am trying to create custom snapshot from some Javascript file. I was able to create a snapshot using the command
mksnapshot.exe snapshot11.js --startup_blob snap.bin
but when I was trying to create an Isolate with this snap.bin file I got this…

Yakir E
- 84
- 4
0
votes
1 answer
V8 QuickIsUndefined crushes randomly when using IsConstructCall
I have a function:
auto func = v8::FunctionTemplate::New(context,
[](const v8::FunctionCallbackInfo& args) {
auto isolate = args.GetIsolate();
if (args.IsConstructCall()) { ... }
...
…

paxbun
- 316
- 1
- 2
- 9
0
votes
1 answer
Default export for synthetic module in V8
I want to use default export with synthetic module in V8. I have synthetic_module, a module which exposes C++ functions to JS, and code like the following:
Local txt = String::NewFromUtf8(isolate, u8R"(
import defaultFoo from…

paxbun
- 316
- 1
- 2
- 9
0
votes
1 answer
hello-world.cc sample seems to leak memory
Just beginning to try to embed V8 in a C++ project. Given the complexity of this library, I thought it would be less terrifying if I could use valgrind as an additional regression tester. Hopefully, regularly checking for a clean run from valgrind…

Ron Burk
- 6,058
- 1
- 18
- 20
0
votes
1 answer
What is the point of MaybeLocal in v8?
Does anyone here know why many of the functions in the v8 API return MaybeLocal handles instead of simply Local types?
I understand that calls can fail, but the Local type already has an IsEmpty() method that could be easily queried anyways, and if…

markt1964
- 2,638
- 2
- 22
- 54
0
votes
1 answer
Call webassembly from embedded v8 with imported function
Call webassembly with import statement from embedded v8 ( without JS )
Following the thread Call webassembly from embedded v8 without JS I was able to call a WebAssembly code directly from c++. My problem started when I tried to run a more "complex"…

Yakir E
- 84
- 4