MATLAB: What files are generated when I compile an MATLAB file using mcc with -m flag

.mcompilercompilingfilesgeneratedMATLAB Compilermcc

I get different results when I compile using the -m macro switch and using the 'equivalent' options listed in the manual.

Best Answer

As mentioned in the documentation, the -m macro is equivalent to:
-t -W main -L C -T link:exe -h libmmfile.mlib
where,
-t means translate to a target language (can be C or C++)
-W main means create a main wrapper function
-L C specifies the target language to be C (can also be Cpp to mean C++)
-T link:exe specifies the building stage and final type (in this case link to an executable)
-h means to automatically find, and compile helper functions included in the source MATLAB file
libmmfile.mlib specifies all MATLAB files that are built into the libmmfile shared library
With either the -m macro or the above-mentioned set of flags, the files that are generated will be:
1. A '.c' and a '.h' file for each of the MATLAB files that are called directly or indirectly in your code
2. One "main" wrapper function
3. One executable file (.exe)