【发布时间】:2017-08-30 03:59:14
【问题描述】:
我似乎无法弄清楚启动 V8 的原因。我有这个代码:
if (!_V8Initialized)
{
v8::V8::InitializeICU();
v8::V8::InitializeExternalStartupData("x86\\"); // (this loads ok, I checked)
auto platform = v8::platform::CreateDefaultPlatform();
v8::V8::InitializePlatform(platform);
v8::V8::Initialize();
_V8Initialized = true;
}
auto params = Isolate::CreateParams();
params.array_buffer_allocator = ArrayBuffer::Allocator::NewDefaultAllocator();
_Isolate = Isolate::New(params);
但我收到此错误:
在 V8.Net.Console.exe 的 0x0000000000000000 处抛出异常: 0xC0000005:访问冲突执行位置0x0000000000000000。
v8_libbase.dll!v8::base::OS::Abort() 第 832 行 C++ v8_libbase.dll!V8_Fatal(const char * file, int line, const char * format, ...) 第 74 行 C++ v8.dll!v8::internal::SnapshotData::SnapshotData(const v8::internal::Vector 快照) 第 28 行 C++ v8.dll!v8::internal::Snapshot::Initialize(v8::internal::Isolate *isolate) 第 43 行 C++ v8.dll!v8::Isolate::New(const v8::Isolate::CreateParams & params) 第 8237 行 C++ V8_Net_Proxy_x64.dll!V8EngineProxy::V8EngineProxy(bool enableDebugging, void()() debugMessageDispatcher, int debugPort) 第 89 行 C++ V8_Net_Proxy_x64.dll!CreateV8EngineProxy(bool enableDebugging, void()() debugMessageDispatcher, int debugPort) 第 19 行 C++ [托管到本地转换]
V8.Net.dll!V8.Net.V8Engine.V8Engine() 第 246 行 C# V8.Net.Console.exe!V8.Net.Program.Main(string[] args) 第 31 行 C# [本机到托管转换]
mscoreei.dll!00007ffdbdd281ad() 未知 mscoree.dll!00007ffdbddc10ab() 未知 kernel32.dll!00007ffdd3868364() 未知 ntdll.dll!00007ffdd5ef70d1() 未知
这里似乎失败了:
explicit SnapshotData(const Vector<const byte> snapshot)
: SerializedData(const_cast<byte*>(snapshot.begin()), snapshot.length()) {
CHECK(IsSane()); <-- THIS FAILS
}
我在这里(大部分)关注了源代码:https://chromium.googlesource.com/v8/v8/+/branch-heads/4.8/samples/hello-world.cc
...但我不确定为什么我似乎收到了一个空错误。我一定是错过了什么……
【问题讨论】:
标签: c++ v8 embedded-v8