2

I'm using V8 32-bit Version 4.10.253 compiled with Visual Studio 2015.

I'm trying to run the example that Google has at: Chrome V8 - Getting Started

But when I try to run it, I get:

Exception thrown at 0x00000000 in V8Test.exe: 0xC0000005: Access 
violation executing location 0x00000000.

I get this when the following is executed:

Isolate* isolate = Isolate::New(create_params);

My project settings:

To get the project to compile in debug, I set the runtime library to:

Multi-threaded Debug /MTd.

I include the v8 include directory under additional include directories.

Lastly, I include the following libraries:

icuuc.lib icui18n.lib v8_libplatform.lib v8_external_snapshot.lib
v8_base_3.lib v8_base_2.lib v8_base_1.lib v8_base_0.lib v8_libbase.lib
winmm.lib

Anyone know what I'm doing wrong? Thanks in advance.

Jonny Henly
  • 4,023
  • 4
  • 26
  • 43
Someone13
  • 443
  • 1
  • 6
  • 18

1 Answers1

1

Ok, I feel stupid. I didn't finish reading the rest of the tutorial. You must copy all the .bin files where your executable is stored. Specifically:

natives_blob.bin
snapshot_blob.bin

V8 will crash at Isolate::New if you do not.

Someone13
  • 443
  • 1
  • 6
  • 18
  • 1
    That's why I use no_snapshot. It's MINUTELY slower on startup, but you don't have to deal with having the right bin files -- which change based on debug/32 vs 64bit/version of V8/etc. Easier to wait the additional .1s or so (when I measured) and not deal with them ever again. Just don't link external_snapshot and link no_snapshot instead. – xaxxon May 01 '16 at 08:33
  • Nice! Thanks for the tip, I'm going to have to give that a shot. – Someone13 May 01 '16 at 09:22
  • 1
    Also, if you're not, make sure you're developing against the debug builds (make x64.debug) -- it gives better failure information before things crash. It's not great, but it's quite a bit better. Also, I think the stack traces are even a bit better, too. – xaxxon May 01 '16 at 10:09
  • Yep, if you link with v8_nosnapshot, you dont have to worry about copying over the bin files. Thanks! – Someone13 May 02 '16 at 08:37
  • 1
    Well, I sure hope so -- otherwise I've been doing something VERY strange all this time :) – xaxxon May 02 '16 at 08:42