engOpenSingleUse() crash on second call

2 views (last 30 days)
Jon
Jon on 5 Oct 2015
Answered: Rohit Kudva on 20 Oct 2015
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.

Answers (1)

Rohit Kudva
Rohit Kudva on 20 Oct 2015
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

Tags

Products

Community Treasure Hunt

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

Start Hunting!