User`s guide
Uses of the Compiler
1-11
Creating Stand-Alone Applications
C Stand-Alone Applications
The MATLAB Compiler, when invoked with the -m macro option, translates
input M-files into C source code that is usable in any of the supported
executable types. The Compiler also produces the required wrapper file
suitable for a stand-alone application. Then, your ANSI C compiler compiles
these C source code files and the resulting object files are linked against the
MATLAB C/C++ Math and Graphics Libraries, which are included with the
MATLAB Compiler. For more information about distributing a C application,
see “Distributing Stand-Alone Applications” on page 4-27.
C++ Stand-Alone Applications
The MATLAB Compiler, when invoked with the -p macro option, translates
input M-files into C++ source code that is usable in any of the executable types
except MEX. The Compiler also produces the required wrapper file suitable for
a stand-alone application. Then, your C++ compiler compiles this C++ source
code and the resulting object files are linked against the MATLAB C/C++ Math
and Graphics Libraries, which are included with the MATLAB Compiler. For
more information about which libraries must be included when you distribute
a C++ application, see “Distributing Stand-Alone Applications” on page 4-27.
Developing a Stand-Alone Application
Suppose you want to create an application that calculates the rank of a large
magic square. One way to create this application is to code the whole
application in C or C++; however, this would require writing your own magic
square, rank, and singular value routines.
An easier way to create this application is to write it as one or more M-files.
Figure 1-2, Developing a Typical Stand-Alone C Application, outlines this
development process.