gpt4 book ai didi

c++ - 调用 Isolate::New() 后执行位置 0x0000000000000000 时发生访问冲突

转载 作者:行者123 更新时间:2023-12-03 12:49:47 29 4
gpt4 key购买 nike

我似乎无法弄清楚如何启动 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);

但我收到此错误:

Exception thrown at 0x0000000000000000 in V8.Net.Console.exe: 0xC0000005: Access violation executing location 0x0000000000000000.

v8_libbase.dll!v8::base::OS::Abort() Line 832 C++ v8_libbase.dll!V8_Fatal(const char * file, int line, const char * format, ...) Line 74 C++ v8.dll!v8::internal::SnapshotData::SnapshotData(const v8::internal::Vector snapshot) Line 28 C++ v8.dll!v8::internal::Snapshot::Initialize(v8::internal::Isolate * isolate) Line 43 C++ v8.dll!v8::Isolate::New(const v8::Isolate::CreateParams & params) Line 8237 C++ V8_Net_Proxy_x64.dll!V8EngineProxy::V8EngineProxy(bool enableDebugging, void()() debugMessageDispatcher, int debugPort) Line 89 C++ V8_Net_Proxy_x64.dll!CreateV8EngineProxy(bool enableDebugging, void()() debugMessageDispatcher, int debugPort) Line 19 C++ [Managed to Native Transition]
V8.Net.dll!V8.Net.V8Engine.V8Engine() Line 246 C# V8.Net.Console.exe!V8.Net.Program.Main(string[] args) Line 31 C# [Native to Managed Transition]
mscoreei.dll!00007ffdbdd281ad() Unknown mscoree.dll!00007ffdbddc10ab() Unknown kernel32.dll!00007ffdd3868364() Unknown ntdll.dll!00007ffdd5ef70d1() Unknown

这里似乎失败了:

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

...但我不确定为什么我会收到空​​错误。我一定错过了一些东西......

最佳答案

没关系,我似乎总是在发布到 SO 后就能弄清楚事情,哈哈。事实证明,我是从 x86 目录加载的,而不是 x64 目录(鉴于 V8_Net_Proxy_x64.dll,我应该猜到!哈哈)。

我本来打算删除这个问题,但无论如何我都会把这个问题留在这里,以防其他人在半夜半睡半醒时陷入这个问题。 ;)

关于c++ - 调用 Isolate::New() 后执行位置 0x0000000000000000 时发生访问冲突,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43215911/

29 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com