forrtl:error(200):程序由于窗口CLOSE事件而中止 [英] forrtl: error (200): program aborting due to window-CLOSE event

查看:474
本文介绍了forrtl:error(200):程序由于窗口CLOSE事件而中止的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

尊敬的先生或女士,



我使用matlab编译器(R2012a)制作了一些matlab代码的共享库(.dll)。



然后我在c ++ win32控制台程序中链接这个库(开发IDE是VS2010)。



代码运行良好,但每当我点击win32控制台表格右上角的关闭按钮退出时,意外断点被触发,程序无法正常退出。



这里有一些细节插图:

-------------------------------- ----------------

1)主要功能部分:



int _tmain(int argc,_TCHAR * argv [])

{

//初始化------



////从自编译lib调用函数

if(!libsen_tradeInitialize())

{

std :: cout<< ------------------ ????无法初始化StrategyLib ???? ------------------- ----! << std :: endl;

getchar();

返回-1;

}

... < br $>


//| ..发布资源



//终止MCR

libsen_tradeTerminate();

mclTerminateApplication();



返回0;

}

--------------------------------------------- -----------------





2)调用堆栈显示:



> libifcoremd.dll!0cbfc25b()

[下面的框架可能不正确和/或缺失,没有为libifcoremd.dll加载符号]

libmmd.dll!0ceaf0bf()

libmmd.dll!0ceaefbb()

apphelp.dll!70b6fff6()

libmmd.dll!0ceaf11d()

libmmd.dll!0ceace0d()

libmmd.dll!0ceace15()

ntdll.dll!776999a0()

ntdll.dll !7769a15e()

ntdll.dll!77699f45()



--------------- ---------------------------------



3 )打印以下声明,程序无法正常终止:



forrtl:错误(200):程序因窗口关闭而中止'事件







4)最后我发现如果我注释掉代码块



/ *

if(!libsen_tradeInitialize())

{

std :: cout<< ------------------ ????无法初始化StrategyLib ???? ------------------- ----! << std :: endl;

getchar();

返回-1;

}

* /



程序可以正常退出,但这对于调用matlab功能是必要的。





在互联网上进行了很多搜索,而对于'forrtl:error(200):'几乎没有结果,除了





http://www.mathworks.com/matlabcentral/newsreader/view_thread/251203







http://stackoverflow.com/questions/15457786/ctrl-c-crashes-python-after-importing-scipy-stats





问题帖子http://www.mathworks.com/matlabcentral/newsreader/view_thread/251203与我非常相似,





虽然我是c ++和matlab的新手,但我无法完全理解



----------的解决方案-------------------------------------------------- ------------------------

我只是用信号来捕捉SIGINT。在所有MCR初始化之后设置了处理程序。



结果是答案是我们没有等待足够长的时间来完成MCR初始化。出乎意料的是,初始化大约需要一分钟或更长时间。当我们提前终止事情时,我们得到了令人惊讶的fortran信号处理!



-------------------- -------------------------------------------------- --------------





以前有人遇到过这个问题吗?能告诉我详细解释吗?





非常感谢你!





知尚

Dear sir or madam,

i have used the matlab compiler (R2012a) to make a shared library (.dll) of some of my matlab code.

then I link this library in a c++ win32 console program(development IDE is VS2010).

the code run well,but whenever I click 'Close' button on the top right corner of the win32 console forms to quit, unexpected breakpoint was triggered and the program can't quit normally.

here's some details illustrations:
------------------------------------------------
1) main funtion segment:

int _tmain(int argc, _TCHAR* argv[])
{
//Initialize------

//// call fuction from self compile lib
if(!libsen_tradeInitialize())
{
std::cout <<"------------------????Could not initialize StrategyLib????-----------------------!" << std::endl;
getchar();
return -1;
}
...

//......Release Resource

// terminate MCR
libsen_tradeTerminate();
mclTerminateApplication();

return 0;
}
--------------------------------------------------------------


2) call stack shows:

> libifcoremd.dll!0cbfc25b()
[Frames below may be incorrect and/or missing, no symbols loaded for libifcoremd.dll]
libmmd.dll!0ceaf0bf()
libmmd.dll!0ceaefbb()
apphelp.dll!70b6fff6()
libmmd.dll!0ceaf11d()
libmmd.dll!0ceace0d()
libmmd.dll!0ceace15()
ntdll.dll!776999a0()
ntdll.dll!7769a15e()
ntdll.dll!77699f45()

------------------------------------------------

3) the following statement is printed, program can't terminate normally:

forrtl: error (200): program aborting due to window-CLOSE' event



4) finally I found that if I comment out the code block

/*
if(!libsen_tradeInitialize())
{
std::cout <<"------------------????Could not initialize StrategyLib????-----------------------!" << std::endl;
getchar();
return -1;
}
*/

the program can quit normally, but this is necessary for invoking matlab funtion.


many search has been done on the internet and few-to-no result for 'forrtl: error (200):' except


http://www.mathworks.com/matlabcentral/newsreader/view_thread/251203

and

http://stackoverflow.com/questions/15457786/ctrl-c-crashes-python-after-importing-scipy-stats


problem post on http://www.mathworks.com/matlabcentral/newsreader/view_thread/251203 is very similar to me,


but while I am a newer of c++ and matlab, I can't exactly understand the solution of

------------------------------------------------------------------------------------
i'm just using signal to catch SIGINT. the handler is set up after all the MCR init stuff.

it turned out that the answer was that we weren't waiting long enough for the MCR initialization to complete. it was unexpected that the initialization took on the order of a minute or more. when we terminated things early, we got a surprising fortran signal handling!

------------------------------------------------------------------------------------


has anyone run into this problem before ? can you please give me detail explanation ?


thanks you very much!


Zhishang

推荐答案

这篇关于forrtl:error(200):程序由于窗口CLOSE事件而中止的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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