You can compile shared libraries from both the MATLAB® command line and the system terminal command line:
deploytool
invokes
the compiler to execute presaved compiler projects
mcc
invokes
the command line compiler
The deploytool
command has two flags to
invoke one of the compiler apps without opening a window.
-build
—
Invoke the correct compiler app to build the project and not generate
an installer.project_name
-package
—
Invoke the correct compiler app to build the project and generate
an installer.project_name
For example, deploytool -package magicsquare
generates
the binary files defined by the magicsquare
project
and packages them into an installer that you can distribute to others.
The mcc
command
invokes the compiler and provides fine-level control over the compilation
of the shared library. It, however, cannot package the results in
an installer.
To invoke the compiler to generate a library use the -l
flag
with mcc
. The -l
flag
creates a C shared library that you can integrate into applications
developed in C or C++.
For compiling shared libraries, you can also use the following options.
Compiler Shared Library Options
Option | Description |
---|---|
-W lib: | Generate a C shared library. Equivalent to using -l . |
-W cpplib: | Generate a C++ shared library. |
-a | Add the file, or files, on the path to the generated binary. |
-d | Specify the folder into which the results of compilation are written. |