Hi, I tried to call v8::Isolate::GetCurrent from a library, both in shared
and static ways. For static, it returns the correct isolate; For shared, it
got NULL.
Running OS is Android 6.0.
Here is my sample code:
void main()
{
...
v8::Isolate* isolate = v8::Isolate::GetCurrent(); //isolate is not
NULL
mylib::getIsolate(); //isolate is not NULL
*g_mylibdlsym_getisolate_fn(); //isolate is NULL*
mylib::getIsolate(); //isolate is not NULL
...
}
>>>details about g_mylibdlsym_getisolate_fn :
g_mylibdlsym_getisolate_fn is loaded by dlsym(library,
g_mylibdlsym_getisolate);
The implementation of g_mylibdlsym_getisolate:
extern "C" {
__attribute__((visibility("default"))) void
g_mylibdlsym_getisolate() {
v8::Isolate* isolate = v8::Isolate::GetCurrent();
printf("isolate=%p",isolate) //isolate is NULL;
}
}
>>>details about mylib::getIsolate()
namespace mylib {
void getIsolate() {
v8::Isolate* isolate = v8::Isolate::GetCurrent();
printf("isolate=%p",isolate) //isolate is not NULL;
}
}
Also, I add some logs at Isolate::Current. If called by
g_mylibdlsym_getisolate, the isolate=0x0, isolate_key_=0x0.
// Returns the isolate inside which the current thread is running.
INLINE(static Isolate* Current()) {
DCHECK(base::NoBarrier_Load(&isolate_key_created_) == 1);
Isolate* isolate = reinterpret_cast<Isolate*>(
base::Thread::GetExistingThreadLocal(isolate_key_));
v8::base::OS::Print("xxxa: %s, %d , isolate=%p, isolate_key_=%x",
__FUNCTION__,__LINE__,isolate,isolate_key_);
DCHECK(isolate != NULL);
return isolate;
}
Any hints for this?
--
--
v8-users mailing list
[email protected]
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 [email protected].
For more options, visit https://groups.google.com/d/optout.