Drexel dragonThe Math ForumDonate to the Math Forum



Search All of the Math Forum:

Views expressed in these public forums are not endorsed by Drexel University or The Math Forum.


Math Forum » Discussions » Software » comp.soft-sys.matlab

Topic: mbuild vs. mex pre-compiling in MATLAB Compiler projects
Replies: 0  

Advanced Search

Back to Topic List Back to Topic List  
Matt J

Posts: 4,996
Registered: 11/28/09
mbuild vs. mex pre-compiling in MATLAB Compiler projects
Posted: Jul 8, 2014 4:54 AM
  Click to see the message monospaced in plain text Plain Text   Click to reply to this topic Reply

I am seeing different behavior when a mex file is compiled using mbuild (as part of a larger MATLAB compiler project) as compared to when it is compiled individually using mex().

One way to include a mex file in the building of a standalone is to pre-compile it from the command line using the mex command and then to add the mex file manually to the list of dependent files. When I take this approach, mex() completes the compilation without errors and, when I run a project build, everything works fine and the resulting standalone .exe performs as desired.

If however, I replace one of the project's mex files, say linterpcpp.mexw64, with the source code file linterpcpp.cpp that it originates from and try to rebuild, mbuild() will run its own pre-compilation of linterpcpp.cpp as part of the overall process of building the standalone. This leads to to an error as follows,

linterpcpp.cpp
<snip>
Deployment\deployment\linterpcpp.cpp(140) : error C2664: 'mxCreateNumericArray_730' : cannot convert parameter 2 from 'int [2]' to 'const mwSize *'
Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast

<snip>

Error: An error occurred while shelling out to mbuild (error code = 9).
Unable to build executable.

I am confused because the file linterpcpp.cpp compiles fine when I do

>> mex linterpcpp.cpp

and I have only one compiler installed on the machine, Microsoft Software Development Kit (SDK) 7.1, so both mbuild() and mex() have to be using the same compiler C/C++ compiler.

Any ideas what's happening?



Point your RSS reader here for a feed of the latest messages in this topic.

[Privacy Policy] [Terms of Use]

© Drexel University 1994-2014. All Rights Reserved.
The Math Forum is a research and educational enterprise of the Drexel University School of Education.