Thursday 15 August 2013

c++ - Matlab engine 2014a won't start under Windows 7 64 bit - missing a 2013a dll -



c++ - Matlab engine 2014a won't start under Windows 7 64 bit - missing a 2013a dll -

i can't start matlab engine using matlab 2014a, win7 64bit, 64bit build c++ programme using vs2012 or vs2013, intel compiler. can start engine fine using matlab 2013a. if link against 2014a programme complains libmwmfl_scalar.dll missing , won't start. dll included 2013 seems no longer included in 2014a (either in programme or in compiler runtime distribution). if link against 2013a runs no problems. why insist on old dll when update 2014a? i've changed includes, libs, environment 2014a , rebuilt after clean. have no explicit reference libmwmfl_scalar.dll in properties , have changed folders 2014a. i'm not linking else uses matlab. dll doesn't show if run dependency walker on linked executable.

the settings in property sheet post (call matlab straight (multiple threading) in visual studio) provides relevant context.

<?xml version="1.0" encoding="utf-8"?> <project toolsversion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> <importgroup label="propertysheets" /> <propertygroup label="usermacros" /> <propertygroup> <localdebuggerenvironment>path=c:\program files\matlab\r2014a\bin\win64;%path%$(localdebuggerenvironment)</localdebuggerenvironment> </propertygroup> <itemdefinitiongroup> <clcompile> <additionalincludedirectories>c:\program files\matlab\r2014a\extern\include;c:\program files\matlab\r2014a\extern\include\win64</additionalincludedirectories> <preprocessordefinitions>ibmpc</preprocessordefinitions> </clcompile> <link> <additionallibrarydirectories>c:\program files\matlab\r2014a\extern\lib\win64\microsoft</additionallibrarydirectories> <additionaldependencies>libmx.lib;libmex.lib;libmat.lib;libeng.lib;mclmcrrt.lib</additionaldependencies> </link> </itemdefinitiongroup> <itemgroup /> </project>

ben - no i'm not using mex files. code calls matlab

void mlsurfaceplot(std::vector<std::vector<double>> surface,std::vector<double> xdat,std::vector<double> ydat) { engine *ep; mxarray *xmx = null, *result = null; mxarray *ymx=null; mxarray *zmx=null; char buffer[bufsize+1]; // double tim[10] = { 0.0, 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0 }; //have stick vectors in arrays matlab xfer double *xarray; //declare pointer type of array xarray = new double[xdat.size()]; //use 'new' create array of size x double *yarray; //declare pointer type of array yarray = new double[ydat.size()]; //use 'new' create array of size x double *zarray; //declare pointer type of array zarray = new double[xdat.size()*ydat.size()]; //use 'new' create array of size x (int j = 0; j < xdat.size(); j++) { xarray[j]=xdat[j]; } (int j = 0; j < ydat.size(); j++) { yarray[j]=ydat[j]; } (int = 0; < xdat.size(); i++) { (int j = 0; j < ydat.size(); j++) { zarray[i+xdat.size()*j]=surface[i][j]; } } /* * phone call engopen null string. starts matlab process * on current host using command "matlab". */ if (!(ep = engopen(""))) { fprintf(stderr, "\ncan't start matlab engine\n"); //return exit_failure; } /* * create variable our info */ using namespace std; xmx = mxcreatedoublematrix(1,xdat.size(), mxreal); ymx = mxcreatedoublematrix(1,ydat.size(), mxreal); zmx = mxcreatedoublematrix(xdat.size(), ydat.size(), mxreal); //t = mxcreatedoublematrix(3, 2, mxreal); //memcpy((void *)mxgetpr(t), (void *)tim, sizeof(tim)); memcpy(mxgetpr(xmx), &xarray[0], sizeof(double)*xdat.size()); memcpy(mxgetpr(ymx), &yarray[0], sizeof(double)*ydat.size()); memcpy(mxgetpr(zmx), &zarray[0], sizeof(double)*xdat.size()*ydat.size()); //std::cout<<t[0]<<std::endl; /* * place variable t matlab workspace */ engputvariable(ep, "x", xmx); engputvariable(ep, "y", ymx); engputvariable(ep, "z", zmx); std::cout<<*mxgetpr(xmx)<<std::endl; std::cout<<*mxgetpr(ymx)<<std::endl; std::cout<<*mxgetpr(zmx)<<std::endl; std::cout<<*(mxgetpr(xmx)+1)<<std::endl; std::cout<<*(mxgetpr(ymx)+1)<<std::endl; std::cout<<*(mxgetpr(zmx)+1)<<std::endl; /* * plot result */ engevalstring(ep, "surf(x,y,z')"); engevalstring(ep, "ylabel('log spot/strike')"); engevalstring(ep, "xlabel('expiry (years)')"); engevalstring(ep, "zlabel('black 76 vol')"); engevalstring(ep, "alpha(0.5)"); engevalstring(ep,"saveas(figure1,'c:\\users\\rodney\\documents\\filename2.jpg'),'jpg'"); /* * utilize fgetc() create sure pause long plenty * able see plot */ printf("hit homecoming continue\n\n"); fgetc(stdin); int jj; cin>>jj; /* * we're done part i! free memory, close matlab figure. */ printf("done part i.\n"); mxdestroyarray(xmx); mxdestroyarray(ymx); mxdestroyarray(zmx); // mxdestroyarray(t); engevalstring(ep, "close;"); // homecoming 0; }

here path, both 2013a , 2014a present. i've tried removing 2013a, relaunching vs, rebuilding still looks old dll.

c:\program files (x86)\common files\intel\shared libraries\redist\intel64\mpirt;c:\program files (x86)\common files\intel\shared libraries\redist\ia32\mpirt;c:\program files (x86)\common files\intel\shared libraries\redist\intel64\compiler;c:\program files (x86)\common files\intel\shared libraries\redist\ia32\compiler;c:\program files (x86)\intel\icsxe\2013.1.046\bin;c:\program files\matlab\r2014a\bin;c:\program files\matlab\r2014a\bin\win64;c:\users\rodney\anaconda\lib\site-packages\pyqt4;c:\program files (x86)\intel\trace analyzer , collector\8.1.4.045\bin;c:\program files (x86)\intel\mpi\4.1.3.045\em64t\bin;c:\program files (x86)\intel\mpi\4.1.3.045\ia32\bin;c:\program files (x86)\common files\intel\shared libraries\redist\intel64\mpirt;c:\program files (x86)\common files\intel\shared libraries\redist\ia32\mpirt;c:\program files (x86)\common files\intel\shared libraries\redist\intel64\compiler;c:\program files (x86)\common files\intel\shared libraries\redist\ia32\compiler;c:\progra~2\intel\mpi\411~1.036\em64t\bin;c:\progra~2\intel\compos~1\bin\intel64;c:\progra~2\intel\compos~1\redist\intel64\compiler;c:\progra~2\micros;c:\program files (x86)\windows kits\8.1\windows performance toolkit\;c:\program files\microsoft sql server\110\tools\binn\;c:\program files (x86)\microsoft asp.net\asp.net web pages\v1.0\;c:\program files (x86)\common files\seagate\snapapi\;c:\program files\matlab\r2014a\runtime\win64;c:\program files\matlab\r2014a\polyspace\bin;\win64;c:\program files\matlab\matlab compiler runtime\v83\runtime\win64;c:\program files\matlab\r2013a\runtime\win64;c:\program files\matlab\r2013a\bin;c:\program files\matlab\r2013a\bin\win64;c:\users\rodney\anaconda;c:\users\rodney\anaconda\scripts;c:\progra~2\gambit-c\v4.7.2\bin;c:\users\rodney\appdata\roaming\cabal\bin;c:\program files (x86)\intel\trace analyzer , collector\8.1.4.045\dll\impi64;c:\program files (x86)\intel\trace analyzer , collector\8.1.3.037\dll\impi64;c:\program files\smartmontools\bin;c:\ghc-7.6.3\bin;c:\program files (x86)\winant\bin;c:\windows\system32;c:\users\rodney\appdata\roaming\cabal\bin\;c:\program files\miktex 2.9\miktex\bin\x64\;c:\program files (x86)\microsoft sdks\typescript\1.0\

update: tried creating new solution , project in vs2013 , works ml2014a. must affecting existing project or solution it's hard track downwards since have no indirect dependencies matlab , have set paths 2014a version. programme uses external libs boost, intel mkl, armadillo, eigen, quantlib. totally stumped.

update 2: i've checked , programme runs when linked against 2014a outside visual studio environment. when seek run vs debugging purposes ("debug/start debugging" or "debug/start without debugging") wont' run because of missing libmwmfl_scalar.dll. reason vs insists on run programme when programme doesn't utilize it.

c++ matlab visual-studio matlab-engine

No comments:

Post a Comment