This is machine translation

Translated by Microsoft
Mouseover text to see original. Click the button below to return to the English verison of the page.

Note: This page has been translated by MathWorks. Please click here
To view all translated materals including this page, select Japan from the country navigator on the bottom of this page.

Simplify Compilation Using Macros


The compiler, through its exhaustive set of options, gives you access to the tools you need to do your job. If you want a simplified approach to compilation, you can use one simple macro that allows you to quickly accomplish basic compilation tasks. Macros let you group several options together to perform a particular type of compilation.

This table shows the relationship between the macro approach to accomplish a standard compilation and the multioption alternative.




Option Equivalence

Function Wrapper |Output Stage ||



-W lib -T link:lib

Standalone application


Working With Macros

The -m option tells the compiler to produce a standalone application. The -m macro is equivalent to the series of options

-W main -T link:exe

This table shows the options that compose the -m macro and the information that they provide to the compiler.

-m Macro



-W main

Produce a wrapper file suitable for a standalone application.

-T link:exe

Create an executable link as the output.

Changing Macros

You can change the meaning of a macro by editing the corresponding macro_option file in matlabroot\toolbox\compiler\bundles. For example, to change the -m macro, edit the file macro_option_m in the bundles folder.


This changes the meaning of -m for all users of this MATLAB® installation.

Specifying Default Macros

As the MCCSTARTUP functionality has been replaced by bundle technology, the macro_default file that resides in toolbox\compiler\bundles can be used to specify default options to the compiler.

For example, adding -mv to the macro_default file causes the command:

 mcc foo.m
to execute as though it were:
mcc -mv foo.m
Similarly, adding -v to the macro_default file causes the command:
mcc -W 'lib:libfoo' -T link:lib foo.m
to behave as though the command were:
mcc -v -W 'lib:libfoo' -T link:lib foo.m

Was this topic helpful?