User`s guide
Uses of the Compiler
1-9
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 Library, which you must have in order to create C or
C++ stand-alone applications. For more information about which libraries
must be included when you distribute a C application, see “Distributing
Stand-Alone UNIX Applications” on page 4-14 or “Distributing Stand-Alone
Windows Applications” on page 4-26.
Note If you do not have the MATLAB C/C++ Graphics Library (libsgl), and
your application calls a Handle Graphics function, a run-time error occurs.
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 arelinked against the MATLAB C/C++ Math
Library. For more information about which libraries must be included when
you distribute a C++ application, see “Distributing Stand-Alone UNIX
Applications” on page 4-14 or “Distributing Stand-Alone Windows
Applications” on page 4-26.
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.
This figure outlines this development process.