SegFault在Windows中的v8在HandleScope构造函数 [英] SegFault in v8 on Windows in HandleScope constructor

查看:337
本文介绍了SegFault在Windows中的v8在HandleScope构造函数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在C ++中开发了一个嵌入了V8的Windows服务。 Debug版本运行良好。问题是发布版本根本不工作。



我使用VisualStudio 2010将V8引擎编译成静态库文件。我将服务的Debug版本与V8调试库链接,并将服务的发行版本与V8版本库链接。



发行版本给SegmFault在程序的第一行是 HandleScope v8Scope; 。 (我实例化v8引擎的本地范围)。不幸的是,我无法调试,因为我运行的发布版本,我不能看到什么是问题,因为在调试版本是运行确定。



我不明白为什么我收到一个SegmFault,当我尝试实例化范围。



您有任何建议如何处理这种情况?



LaterEdit:



使用followind代码,我意识到当前的Isolate是NULL。 SO,现在我的问题是如何创建一个不是NULL的Isolate上下文。

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

谢谢,

解决方案

如果有人有同样的问题,这里是答案:



由于某种原因,似乎V8引擎不调用自己的初始化功能。因此,如果你把 V8 :: initialize(); 作为你程序的第一行,那就行了。



要创建一个新的Isolate不是NULL,你必须调用 Isolate * isolate = Isolate :: New()


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,

解决方案

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()

这篇关于SegFault在Windows中的v8在HandleScope构造函数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆