我似乎无法弄清楚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 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)第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
...但我不确定为什么我似乎得到一个空错误。我一定错过了什么......
答案 0 :(得分:0)
没关系,我总是在发布到SO之后想出事情,哈哈。事实证明我是从x86目录而不是x64目录加载的(考虑到V8_Net_Proxy_x64.dll,我应该猜到它!lol)。
我打算删除这个问题,但无论如何我都会留在这里以防万一其他人在半夜睡着了。 ;)