Hello everyone,
I need to use v8 as shared library in both linux (gcc) and Windows (msvc). Previously (e.g. v8 version 3.28) I can manage that by specifying component=shared_library as an argument to make in linux,
and -Dcomponent=shared_library as an argument to build\gyp_v8 in Windows. To use libv8.so (linux) I linked against it, and to use v8.dll (Windows) I linked against the v8.lib import library.
Notice that in the past, the following v8 initialization code was sufficient:
V8::Initialize();
Isolate::New()->Enter();
Now things have changed. I'm trying to upgrade to v8 4.8.99, particularly commit 961fef2dd2852db5165de3dbdbd13162792448fe (30.10.2015 05:57:23 2015 -0700).
The initialization code now involves the following:
V8::InitializeICU();
V8::InitializeExternalStartupData(argv[0]);
Platform* platform = platform::CreateDefaultPlatform();
V8::InitializePlatform(platform);
V8::Initialize();
plus more complicated Isolate instance creation, as described
here.
If I only link against v8, the linker complains that platform::CreateDefaultPlatform() is an undefined reference. Therefore, I need to link against
v8_libplatform, too, which is a static library.
When I do so in Linux, everything works well, provided I disable snapshots (snapshot=off) in v8 build.
In Windows, however, this does not work. The problem is that the
source code of v8_libplatform refers to V8_Fatal() that is implemented in v8 (file src/base/logging.cc) but not exported.
Therefore, linking to v8_libplatform.lib fails.My question is as follows:
How should I build and use v8 shared library on Windows using Microsoft Visual Studio?
Best regards,
Stepan Orlov