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 CenterFile Exchange 中查找有关 Call MATLAB from C 的更多信息

标签

产品

Community Treasure Hunt

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

Start Hunting!

Translated by