| MATLAB Compiler | ![]() |
Syntax
Description
mcc is the MATLAB command that invokes the MATLAB Compiler. You can issue the mcc command either from the MATLAB command prompt (MATLAB mode) or the DOS or UNIX command line (stand-alone mode).
Prepares M-file(s) for deployment outside of the MATLAB environment. Generates wrapper files in C or C++, and optionally builds stand-alone binary files. Writes any resulting files into the current directory, by default.
If more than one M-file is specified on the command line, the Compiler generates a C or C++ function for each M-file. If C or object files are specified, they are passed to mbuild along with any generated C files.
Options
-a Add to Archive. Add a file to the CTF archive. Use
to specify a file to be directly added to the CTF archive. Multiple -a options are permitted. The Compiler looks for these files on the MATLAB path, so specifying the full pathname is optional. These files are not passed to mbuild, so you can include files such as data files.
-b Generate Excel-Compatible Formula Function. Generate a Visual Basic file (.bas) containing the Microsoft Excel Formula Function interface to the Compiler-generated COM object. When imported into the workbook Visual Basic code, this code allows the MATLAB function to be seen as a cell formula function. Requires MATLAB Builder for Excel.
-B Specify bundle File. Replace the file on the mcc command line with the contents of the specified file. Use
The bundle file filename should contain only mcc command line options and corresponding arguments and/or other filenames. The file may contain other -B options. A bundle file can include replacement parameters for Compiler options that accept names and version numbers. See Using Bundle Files for a list of the bundle files included with the Compiler.
-c Generate C Code Only. When used with a macro option, generate C code but do not invoke mbuild, i.e., do not produce a stand-alone application. This option is equivalent to -T codegen placed at the end of the mcc command line.
-d Specified Directory for Output. Place output in a specified directory. Use
to direct the output files from the compilation to the directory specified by the -d option.
-f Specified Options File. Override the default options file with the specified options file. Use
to specify filename as the options file when calling mbuild. This option allows you to use different ANSI compilers for different invocations of the MATLAB Compiler. This option is a direct pass-through to the mbuild script.
-g Generate Debugging Information. Include debugging symbol information for the C/C++ code generated by the MATLAB Compiler. It also causes mbuild to pass appropriate debugging flags to the system C/C++ compiler. The debug option enables you to backtrace up to the point where you can identify if the failure occurred in the initialization of MCR, the function call, or the termination routine. This option does not allow you to debug your M-files with a C/C++ debugger.
-I Add Directory to Path. Add a new directory path to the list of included directories. Each -I option adds a directory to the end of the current search path. For example,
would set up the search path so that directory1 is searched first for M-files, followed by directory2. This option is important for stand-alone compilation where the MATLAB path is not available.
-l Generate a Function Library. Macro to create a function library. This option generates a library wrapper function for each M-file on the command line and calls your C compiler to build a shared library, which exports these functions. The library name is the component name, which is derived from the name of the first M-file on the command line. This macro is equivalent to
-m Generate a Stand-Alone Application. Macro to produce a stand-alone application. This macro is equivalent to
-M Direct Pass Through. Define compile-time options. Use
to pass string directly to the mbuild script. This provides a useful mechanism for defining compile-time options, e.g., -M "-Dmacro=value".
-N Clear Path. Passing -N effectively clears the path of all directories except the following core directories (this list is subject to change over time):
It also retains all subdirectories of the above list that appear on the MATLAB path at compile time. Including -N on the command line also allows you to replace directories from the original path, while retaining the relative ordering of the included directories. All subdirectories of the included directories that appear on the original path are also included.
-o Specify Executable. Specify the name of the final executable (stand-alone applications only). Use
to name the final executable output of the Compiler. A suitable, possibly platform-dependent, extension is added to the specified name (e.g., .exe for Windows stand-alone applications).
-p Add Directory to Path. Add a directory to the compilation path in an order-sensitive context, i.e., the same order in which they are found on your MATLAB path.
where directory is the directory to be included. If directory is not an absolute path, it is assumed to be under the current working directory. The rules for how these directories are included are
-p that is on the original MATLAB path, the directory and all its subdirectories that appear on the original path are added to the compilation path in an order-sensitive context.
-p that is not on the original MATLAB path, that directory is not included in the compilation. (You can use -I to add it.)
If a path is added with the -I option while this feature is active (-N has been passed) and it is already on the MATLAB path, it is added in the order-sensitive context as if it were included with -p. Otherwise, the directory is added to the head of the path, as it normally would be with -I.
-R Run-Time. Provide MCR run-time options. Use the syntax
to provide any of these run-time options.
| Option |
Description |
|---|---|
-nojvm |
Do not use the Java Virtual Machine (JVM). |
-nojit |
Do not use the MATLAB JIT (binary code generation used to accelerate M-file execution). |
Note
The -R option is only available for stand-alone applications. To override MCR options in the other MATLAB Compiler targets, use the mclInitializeApplication and mclTerminateApplication functions. For more information on these functions, see Calling a Shared Library.
|
-S Create Singleton MCR. Create a singleton MCR when compiling a COM object. Each instance of the component uses the same MCR. Requires MATLAB Builder for COM.
-T Specify Target Stage. Specify the output target phase and type. Use the syntax
to define the output type. Valid target values are as follows:
-v Verbose. Display the compilation steps, including
mbuild
The -v option passes the -v option to mbuild and displays information about mbuild.
-w Warning Messages. Displays warning messages. Use the syntax
to control the display of warnings. This table lists the valid syntaxes.
| Syntax |
Description |
|---|---|
|
Generates a table that maps <string> to warning message for use with enable, disable, and error. Appendix B, Error and Warning Messages lists the same information. |
|
Enables complete warnings. |
|
Disables specific warning associated with <string>. Appendix B, Error and Warning Messages lists the valid <string> values. Leave off the optional :<string> to apply the disable action to all warnings. |
|
Enables specific warning associated with <string>. Appendix B, Error and Warning Messages lists the valid <string> values. Leave off the optional :<string> to apply the enable action to all warnings. |
|
Treats specific warning associated with <string> as error. Leave off the optional :<string> to apply the error action to all warnings. |
-W Wrapper Function. Controls the generation of function wrappers. Use the syntax
to control the generation of function wrappers for a collection of Compiler-generated M-files. You provide a list of functions and the Compiler generates the wrapper functions and any appropriate global variable definitions. This table shows the valid options.
to override default license.dat file with specified argument.
-z Specify Path. Specify path for library and include files. Use
to specify path to use for the compiler libraries and include files instead of the path returned by matlabroot.
-? Help Message. Display MATLAB Compiler help at the command prompt.
Examples
Make a stand-alone executable for myfun.m.
Make a stand-alone executable for myfun.m, but look for myfun.m in the /files/source directory and put the resulting C files and executable in the /files/target directory.
Make the stand-alone executable myfun1 from myfun1.m and myfun2.m (using one mcc call).
Make a shared/dynamically linked library called liba from a0.m and a1.m.
| mbuild | MATLAB Compiler Quick Reference | ![]() |
© 1994-2005 The MathWorks, Inc.