Products & Services Solutions Academia Support User Community Company

Learn more about MATLAB Compiler   

Using Macros to Simplify Compilation

Macro Options

MATLAB 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 option, i.e., 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.

Macro
Option

Bundle File

Creates

Option Equivalence

Function Wrapper
|            Output Stage
|            |

-lmacro_option_l

Library

-W lib       -T link:lib
-mmacro_option_m

Standalone C application

-W main      -T link:exe

Working With Macro Options

The -m option tells MATLAB Compiler to produce a standalone C 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 MATLAB Compiler.

-m Macro

Option

Function

-W main

Produce a wrapper file suitable for a standalone application.

-T link:exe

Create an executable link as the output.

Changing Macro Options

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

Specifying Default Macro Options

As the MCCSTARTUP functionality has been replaced by bundle file 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
  


Recommended Products

Includes the most popular MATLAB recorded presentations with Q&A sessions led by MATLAB experts.

 © 1984-2009- The MathWorks, Inc.    -   Site Help   -   Patents   -   Trademarks   -   Privacy Policy   -   Preventing Piracy   -   RSS