I am cross compiling V8 for android and I have created a shared library
containing a simple function which adds some property to a provided object:
extern "C" void MyFunc(Isolate* isolate, Local<Object>& obj) {
Local<Context> context = isolate->GetCurrentContext();
obj->Set(context, v8::String::NewFromUtf8(isolate,
"someProp").ToLocalChecked(), Number::New(isolate, 500));
}
My goal purpose is to call this function from my android application in which
I have embedded V8:
typedef void (*MyCallback)(Isolate* isolate, Local<Object>& obj);
void* handle =
dlopen("/data/data/com.tns.testapplication/files/app/modules/libCalc-x86_64.so",
RTLD_LAZY);
MyCallback func = reinterpret_cast<MyCallback>(dlsym(handle, "MyFunc"));
Local<Object> exportsObj = Object::New(isolate);
func(isolate, exportsObj);
This successfully invokes "MyFunc" from the shared library and sets the
"someProp" property on the passed object.
Starting from V8 *7.7.299.11* calling obj->Set() inside the library crashes
with SIGSEGV and without any stacktrace.
I have noticed that if I set the property before calling the function then it
works:
exportsObj->Set(context, v8::String::NewFromUtf8(isolate,
"someProp").ToLocalChecked(), v8::Null(isolate));
func(isolate, exportsObj);
Any idea what might have changed between the official V8 7.6 and 7.7 releases
that might explain this behaviour or any tips that would allow me to debug this
further?
--
--
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].
To view this discussion on the web visit
https://groups.google.com/d/msgid/v8-users/48a71b41-b96e-41ec-9450-fa36d6f1bb45%40googlegroups.com.