How to create a standalon exe of mfile including mexfunction?

3 views (last 30 days)
I created a mfile, including the matlab function and the mexfunction by c++. How do I create a standalon exe of this mfile? The mfile can execute in the Matlab envirement. But I try to create a standlon exe of the mfile and executing without the Matlab envirement.

Accepted Answer

Kaustubha Govind
Kaustubha Govind on 15 Aug 2013
Since you would like to compile a MEX-function, which needs MATLAB runtime libraries to be executed, the right choice would be for you to pick the MATLAB Compiler product to produce an executable from your MATLAB-file. Note, however, that the MATLAB Compiler Runtime (MCR) needs to be installed on all target machines to be able to run the executable.
If you would like a truly standalone executable, you will need to use MATLAB Coder, which has a stricter set of rules for the MATLAB language subset that you can generate C/C++ code from. However, you cannot generate code from MEX-files, so you might instead want to get rid of the MEX-wrapper and directly call the C code from your MATLAB code using coder.ceval so that the corresponding calls into the C code are directly inlined into the generated code.

More Answers (0)

Categories

Find more on C Shared Library Integration in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!