engOpenSingleUse() crash on second call

1 回表示 (過去 30 日間)
Jon
Jon 2015 年 10 月 5 日
回答済み: Rohit Kudva 2015 年 10 月 20 日
I am using matlab 2015a and calling engOpenSingleUse() from Visual Studio 2010.
I can successfully start and use the engine, but if I try to open the engine for a second time it causes the debugger to crash. Crash might be the wrong word - it ends my c++ program (running in debug mode) without even throwing an exception.
I can replicate this just by running the following:
matlabEngine = engOpenSingleUse(NULL,NULL,&retstatus);
engClose(matlabEngine);
matlabEngine = engOpenSingleUse(NULL,NULL,&retstatus); //program crashes here
Am I doing something wrong? The call to engClose() returns 0 as expected.

回答 (1 件)

Rohit Kudva
Rohit Kudva 2015 年 10 月 20 日
Hi Jon,
I understand that when you used 'engOpenSingleUse' function the second time after closing the previous instance of MATLAB engine, your application exited without any exception. I was not able to reproduce this issue on my end but I found link on MATLAB Answers on how to Compile Engine application for Microsoft Visual Studio 2010
I hope the steps provided in the link above resolves the issue.
Regards,
Rohit

カテゴリ

Help Center および File ExchangeCall MATLAB from C についてさらに検索

タグ

製品

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by