SegFault in v8 on Windows in HandleScope constructor

梦想与她 提交于 2020-01-15 10:49:48

问题


I developed a Windows Service in C++ that has V8 embedded. The Debug version is working good. The problem is that the Release version is not working at all.

I compiled the V8 engine using VisualStudio 2010 into a static-lib file. I linked the Debug version of the service with V8 debug libs and the Release version of the service with V8 release libs.

The Release version give SegmFault at the first line of the program which is HandleScope v8Scope;. (I instantiated the local scope for the v8 engine).

Unfortunately, I can't debug because I run the Release version, and I can't see what is the problem because in debug version is running ok.

I don't understand why I receive a SegmFault, when I try to instantiate the scope.

Do you have any suggestions for me how to approach this situation?

LaterEdit:

Using the followind code, I realized that the current Isolate is NULL. SO, now my question is how to create a Isolate context that is not NULL.

Isolate* isolate = Isolate::GetCurrent();
if (isolate==NULL)
    return;
Locker v8Locker;
HandleScope v8Scope(isolate);  

Thank you,


回答1:


If someone has the same problem, here is the answer:

For some reason, it seems that V8 engine doesn't call its own initialize function. So if you put the line V8::initialize(); as the first line of your program it's gonna be ok.

To create, a new Isolate that is not NULL, you have to call Isolate *isolate=Isolate::New()



来源:https://stackoverflow.com/questions/16924087/segfault-in-v8-on-windows-in-handlescope-constructor

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!