Can I use VS2008 Express with loadlibrary?

1 view (last 30 days)
Fred
Fred on 25 Dec 2013
I've read a fair number of posts on compiler compatibility, etc., but I'm still not clear on this. My OS is Win7-Pro/SP1-x64, I'm using R2010a and have installed VS2008 Express SP1 as well as SDK7 + .NET 3.5. I can do mex -setup and see the expected option (see below). I can also compile and run yprime without issue, so it seems the 64b compiler is set up correctly. However when I try to use loadlibrary() I get an error that cl can not be found. A bit more investigation shows that loadlibrary is calling vcvarsall.bat which for some reason can not find the amd64 compiler options.
Am I attempting the impossible here? I didn't notice until after going through this that the compiler-selection matrix for r2010a does not have a check mark for VS2008-Express under "for shared library interface," which I'm now guessing is loadlibrary, even though the non-express version is checked.
TIA, Fred
Output transcript:
mex -setup
Please choose your compiler for building external interface (MEX) files:
Would you like mex to locate installed compilers [y]/n? y
Select a compiler:
[1] Microsoft Visual C++ 2008 Express in C:\Program Files (x86)\Microsoft Visual Studio 9.0
[0] None
Compiler: 1
Please verify your choices:
Compiler: Microsoft Visual C++ 2008 Express
Location: C:\Program Files (x86)\Microsoft Visual Studio 9.0
Are these correct [y]/n?
***************************************************************************
Warning: MEX-files generated using Microsoft Visual C++ 2008 require
that Microsoft Visual Studio 2008 run-time libraries be
available on the computer they are run on.
If you plan to redistribute your MEX-files to other MATLAB
users, be sure that they have the run-time libraries.
***************************************************************************
Trying to update options file: C:\Users\<me>\AppData\Roaming\MathWorks\MATLAB\R2010a\mexopts.bat
From template: C:\PROGRA~1\MATLAB\R2010a\bin\win64\mexopts\msvc90freeopts.bat
Done . . .
**************************************************************************
Warning: The MATLAB C and Fortran API has changed to support MATLAB
variables with more than 2^32-1 elements. In the near future
you will be required to update your code to utilize the new
API. You can find more information about this at:
http://www.mathworks.com/support/solutions/en/data/1-5C27B9/?solution=1-5C27B9
Building with the -largeArrayDims option enables the new API.
**************************************************************************
>> mex -v yprime.c
This is mex, Copyright 1984-2007 The MathWorks, Inc.
-> Default options filename found in C:\Users\<me>\AppData\Roaming\MathWorks\MATLAB\R2010a
----------------------------------------------------------------
-> Options file = C:\Users\<me>\AppData\Roaming\MathWorks\MATLAB\R2010a\mexopts.bat
MATLAB = C:\PROGRA~1\MATLAB\R2010A
-> COMPILER = cl
-> Compiler flags:
COMPFLAGS = /c /Zp8 /GR /W3 /EHs /D_CRT_SECURE_NO_DEPRECATE /D_SCL_SECURE_NO_DEPRECATE /D_SECURE_SCL=0 /DMATLAB_MEX_FILE /nologo /MD
OPTIMFLAGS = /O2 /Oy- /DNDEBUG
DEBUGFLAGS = /Z7
arguments =
Name switch = /Fo
-> Pre-linking commands =
-> LINKER = link
-> Link directives:
LINKFLAGS = /dll /export:mexFunction /LIBPATH:"C:\PROGRA~1\MATLAB\R2010A\extern\lib\win64\microsoft" libmx.lib libmex.lib libmat.lib /MACHINE:X64 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /incremental:NO /implib:"C:\USERS\<me>\APPDATA\LOCAL\TEMP\MEX_O2~1\templib.x" /MAP:"yprime.mexw64.map"
LINKDEBUGFLAGS = /DEBUG /PDB:"yprime.mexw64.pdb"
LINKFLAGSPOST =
Name directive = /out:"yprime.mexw64"
File link directive =
Lib. link directive =
Rsp file indicator = @
-> Resource Compiler = rc /fo "mexversion.res"
-> Resource Linker =
----------------------------------------------------------------
--> cl /c /Zp8 /GR /W3 /EHs /D_CRT_SECURE_NO_DEPRECATE /D_SCL_SECURE_NO_DEPRECATE /D_SECURE_SCL=0 /DMATLAB_MEX_FILE /nologo /MD /FoC:\USERS\<me>\APPDATA\LOCAL\TEMP\MEX_O2~1\yprime.obj -IC:\PROGRA~1\MATLAB\R2010A\extern\include -IC:\PROGRA~1\MATLAB\R2010A\simulink\include /O2 /Oy- /DNDEBUG -DMX_COMPAT_32 yprime.c
yprime.c
yprime.c(85) : warning C4267: '=' : conversion from 'size_t' to 'mwSize', possible loss of data
yprime.c(86) : warning C4267: '=' : conversion from 'size_t' to 'mwSize', possible loss of data
Contents of C:\USERS\<me>\APPDATA\LOCAL\TEMP\MEX_O2~1\mex_tmp.rsp:
C:\USERS\<me>\APPDATA\LOCAL\TEMP\MEX_O2~1\yprime.obj
--> link /out:"yprime.mexw64" /dll /export:mexFunction /LIBPATH:"C:\PROGRA~1\MATLAB\R2010A\extern\lib\win64\microsoft" libmx.lib libmex.lib libmat.lib /MACHINE:X64 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /incremental:NO /implib:"C:\USERS\<me>\APPDATA\LOCAL\TEMP\MEX_O2~1\templib.x" /MAP:"yprime.mexw64.map" @C:\USERS\<me>\APPDATA\LOCAL\TEMP\MEX_O2~1\MEX_TMP.RSP
Creating library C:\USERS\<me>\APPDATA\LOCAL\TEMP\MEX_O2~1\templib.x and object C:\USERS\<me>\APPDATA\LOCAL\TEMP\MEX_O2~1\templib.exp
--> del "C:\USERS\<me>\APPDATA\LOCAL\TEMP\MEX_O2~1\templib.x" "C:\USERS\<me>\APPDATA\LOCAL\TEMP\MEX_O2~1\templib.exp"
--> mt -outputresource:"yprime.mexw64;2" -manifest "yprime.mexw64.manifest"
Microsoft (R) Manifest Tool version 5.2.3790.2076
Copyright (c) Microsoft Corporation 2005.
All rights reserved.
--> del "yprime.mexw64.manifest"
--> del "yprime.mexw64.map"
>> yprime(1,1:4)
ans =
2.0000 8.9685 4.0000 -1.0947
>> <my script w/loadlibary>
??? Error using ==> loadlibrary at 368
Failed to preprocess the input file.
Output from preprocessor is:'cl' is not recognized as an internal or external command,
operable program or batch file.

Answers (0)

Categories

Find more on MATLAB Compiler in Help Center and File Exchange

Products

Community Treasure Hunt

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

Start Hunting!