'Platform' is null ... ?

182 views
Skip to first unread message

James W

unread,
Sep 4, 2014, 4:36:17 PM9/4/14
to v8-u...@googlegroups.com
I'm calling "Isolate->IdleNotification(100)" within an isolate scope (via "v8::Isolate::Scope ..."), and at some point when "V8::GetCurrentPlatform()->CallOnBackgroundThread(...)" is called within V8, "V8::GetCurrentPlatform()" returns NULL, and the whole thing dies a fatal death. Any ideas why the current platform might be null? Or rather, what should be done to make sure it isn't? All my javascript test scripts run perfectly - just the garbage collection fails when I try to force it using that call.  Should I be calling it outside an isolate scope (and locker).

James W

unread,
Sep 4, 2014, 4:51:36 PM9/4/14
to v8-u...@googlegroups.com
Addition details: I'm using Visual Studio 2013, and compiled the source, the resulting libraries of which I use with the V8.Net wrapper (on codeplex). I run the following code before triggering the idle notification call:

v8::Locker __lockScope(engine->Isolate());
v8
::Isolate::Scope __isolateScope(engine->Isolate());
v8
::HandleScope __handleScope(Isolate::GetCurrent());

I tried different combinations, and it seems only `v8::Locker __lockScope` is required, but the platform is still null;

v8::Platform* V8::GetCurrentPlatform() {  
DCHECK
(platform_);   // <-- 'platform_' is NULL
return platform_;
}




Sven Panne

unread,
Sep 5, 2014, 3:23:56 AM9/5/14
to v8-u...@googlegroups.com
You need to initialize the platform, see e.g. https://code.google.com/p/v8/source/browse/branches/bleeding_edge/samples/shell.cc#82. No fancy locking etc. involved here, the platform is internally just  a global variable. Not nice, but OK for now...

Jochen Eisinger

unread,
Sep 5, 2014, 3:53:32 AM9/5/14
to v8-u...@googlegroups.com
Note that you'll also need to link against the v8_libplatform library to make this work

best
-jochen


On Fri, Sep 5, 2014 at 9:23 AM, Sven Panne <sven...@chromium.org> wrote:
You need to initialize the platform, see e.g. https://code.google.com/p/v8/source/browse/branches/bleeding_edge/samples/shell.cc#82. No fancy locking etc. involved here, the platform is internally just  a global variable. Not nice, but OK for now...

--
--
v8-users mailing list
v8-u...@googlegroups.com
http://groups.google.com/group/v8-users
---
You received this message because you are subscribed to the Google Groups "v8-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to v8-users+u...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

James

unread,
Sep 5, 2014, 11:47:32 AM9/5/14
to v8-u...@googlegroups.com
Why is this not shown in the Google embedders guide?

-jw
(sent via iPhone)
You received this message because you are subscribed to a topic in the Google Groups "v8-users" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/v8-users/wjMwflJkfso/unsubscribe.
To unsubscribe from this group and all its topics, send an email to v8-users+u...@googlegroups.com.

Louis Santillan

unread,
Sep 5, 2014, 1:17:58 PM9/5/14
to v8-u...@googlegroups.com
The philosophy seems to be that the code is always the most up to date
Documentation of v8. So questions about API and usage are best
answered by reading v8.h [0], and d8.cc [1] and/or samples (shell.cc
[2], process.cc [3], and lineprocessor.cc [4]), and/or the files in
src/.

[0] (https://code.google.com/p/v8/source/browse/trunk/include/v8.h)
[1] (https://code.google.com/p/v8/source/browse/trunk/src/d8.cc)
[2] (https://code.google.com/p/v8/source/browse/trunk/samples/shell.cc)
[3] (https://code.google.com/p/v8/source/browse/trunk/samples/process.cc)
[4] (https://code.google.com/p/v8/source/browse/trunk/samples/lineprocessor.cc)

James

unread,
Sep 5, 2014, 3:53:51 PM9/5/14
to v8-u...@googlegroups.com
Ok, thanks.

-jw
(sent via iPhone)

Jochen Eisinger

unread,
Sep 8, 2014, 4:42:29 AM9/8/14
to v8-u...@googlegroups.com
Hey,

that's not true. API changes are documented here: http://bit.ly/v8-api-changes and there was an PSA about this change a few weeks ago and API changes are documented in the logs of each release.

However, if you chose to build from bleeding_edge or any other not yet released version, you're indeed on your own. And our public docs, of course, reflect the API of the latest stable version.

best
-jochen

James

unread,
Sep 8, 2014, 5:01:05 AM9/8/14
to v8-u...@googlegroups.com
Thanks - would be nice if this is more accessible from the V8 project page (https://code.google.com/p/v8/). I shouldn't have to hunt it down.

-jw
(sent via iPhone)

James W

unread,
Sep 9, 2014, 10:28:29 PM9/9/14
to v8-u...@googlegroups.com
I compiled V8 successfully, and included "libplatform.h" in my host code (in order to call "v8::platform::CreateDefaultPlatform()"). "libplatform.h" now complains "error C1083: Cannot open include file: '\include/v8-platform.h': No such file or directory ....\include\libplatform\libplatform.h".  I can see that "v8_libplatform.lib" exists in V8's 'lib' folder, but no dll in the dll output folder (the parent folder).  Is there supposed to be a DLL, or is it part of an existing one? Not sure how this is put together.

Jochen Eisinger

unread,
Sep 10, 2014, 3:44:13 AM9/10/14
to v8-u...@googlegroups.com
you need to add the v8 directory to your include paths (not v8/include - though having both is also fine).

And yes, you have to link against the .lib file, there is no dll support for v8_libplatform (yet)

best
-jochen

Reply all
Reply to author
Forward
0 new messages