调用 Isolate::New() 后访问冲突执行位置 0x0000000000000000 [英] Access violation executing location 0x0000000000000000 after calling Isolate::New()

查看:23
本文介绍了调用 Isolate::New() 后访问冲突执行位置 0x0000000000000000的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我似乎无法弄清楚如何启动 V8.我有这个代码:

I can't seem to figure out something getting V8 started up. I have this code:

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.

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

v8_libbase.dll!v8::base::OS::Abort() 第 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) 第 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) Line 89 C++V8_Net_Proxy_x64.dll!CreateV8EngineProxy(bool enableDebugging, void()() debugMessageDispatcher, int debugPort) Line 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() 未知

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

I followed the source code here (for the most part): https://chromium.googlesource.com/v8/v8/+/branch-heads/4.8/samples/hello-world.cc

...但我不知道为什么我似乎收到了一个空错误.我一定是遗漏了什么……

... but I'm not sure why it seems I'm getting a null error. I must be missing something...

推荐答案

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

Nevermind, I always seem to figure things out AFTER posting to SO, lol. It turns out I was loading from the x86 directory and not the x64 directory (which I should have guess given the V8_Net_Proxy_x64.dll! lol).

我打算删除这个问题,但无论如何我都会把它留在这里,以防其他人在半夜睡着了.;)

I was going to delete the question, but I'll leave this here anyhow in case someone else falls into this in the middle of the night half asleep. ;)

这篇关于调用 Isolate::New() 后访问冲突执行位置 0x0000000000000000的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆