C engine: rebuild required when MATLAB upgraded?

1 view (last 30 days)
We have a C++ application that calls engopen() and other MATLAB C-engine routines. Do we have to rebuild it every time we upgrade the version of MATLAB that is installed on the computer or can we just change the runtime environment: update the PATH order and execute matlab /regserver as described in other topics?

Accepted Answer

James Tursa
James Tursa on 9 Feb 2011
One problem with Engine applications is that they will start the MATLAB version that most recently executed a matlab/regserver, which is not necessarily the version they were compiled with. So if you have app1 compiled with MATLAB version "A" and app2 compiled under MATLAB version "B", they will both attempt to start the Engine using the same version of MATLAB (even if both "A" and "B" versions are installed), and of course one of them may fail. It's a pain, but the only way I have gotten it to work is to either recompile or to re-execute a matlab/regserver for the specific required version of MATLAB prior to starting the app.
  2 Comments
John
John on 9 Feb 2011
Thank you. So, if we want an app to work with 'any' version of MATLAB, we need to rebuild the app linking in the MATLAB lib files for each version of MATLAB as it becomes available. Correct? Or, perhaps it would be maintained more easily if the engine calls were all collected in a DLL built for each MATLAB version. Does that seem reasonable?
James Tursa
James Tursa on 10 Feb 2011
I don't know if it is possible to have a single app work with several versions of MATLAB. Seems to me you would have name clashes in the linking. But this is beyond my experience as I have never tried it. I think you are stuck with rebuilding the app for each version and then either always use the latest version *or* have a bat file that executes a matlab/regserver for a specific version of MATLAB (it doesn't have to be the latest version) prior to starting up the app.

Sign in to comment.

More Answers (0)

Products

Community Treasure Hunt

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

Start Hunting!