Compile and link source files against MATLAB generated shared libraries
mbuild [option1
...optionN
]sourcefile1
[...sourcefileN
] [objectfile1
...objectfileN
] [libraryfile1
...libraryfileN
]
mbuild
compiles
and links customer written C or C++ code against MATLAB® generated
shared libraries.
Some of these options (-f
, -g
,
and -v
) are available on the mcc
command
line and are passed along to mbuild
. Others can
be passed along using the -M
option to mcc
.
For details on the -M
option, see the mcc
reference page.
Supported types of source files are:
.c
.cpp
Source files that are not one of the supported types are pass ed to the linker.
This table lists the set of mbuild
options.
If no platform is listed, the option is available on both UNIX® and Windows®.
Option | Description | |
---|---|---|
@<rspfile> | (Windows only) Include the contents of the text
file | |
-<arch> | Build an output file for architecture | |
-c | Compile only. Creates an object file only. | |
-D<name> | Define a symbol name to the C preprocessor. Equivalent
to a | |
-D<name>=<value> | Define a symbol name and value to the C preprocessor.
Equivalent to a | |
-f <optionsfile> | Specify location and name of options file to use. Overrides
the | |
-g | Create an executable containing additional symbolic information
for use in debugging. This option disables the | |
-h[elp] | Print help for | |
-I<pathname> | Add | |
-l<name> | Link with object library. On Windows systems,
| |
-L<folder> | Add | |
-n | No execute mode. Print out any commands that | |
-O | Optimize the object code. Optimization is enabled by
default and by including this option on the command line. If the | |
-outdir <dirname> | Place all output files in folder | |
-output <resultname> | Create an executable named | |
-setup | Interactively specify the C/C++ compiler options file
to use as the default for future invocations of | |
-setup -client mbuild_com | Interactively specify the COM compiler options file to
use as the default for future invocations of | |
-U<name> | Remove any initial definition of the C preprocessor symbol | |
-v | Verbose mode. Print the values for important internal variables after the options file is processed and all command line arguments are considered. Prints each compile step and final link step fully evaluated. | |
<name>=<value> | Supplement or override an options file variable for variable It is common to use this option to supplement
a variable already defined. To do this, refer to the variable by prepending
a |
To change the default C/C++ compiler for use with MATLAB Compiler SDK™, use
mbuild -setup
To compile and link an external C program foo.c
against libfoo
,
use
mbuild foo.c -L. -lfoo (on UNIX) mbuild foo.c libfoo.lib (on Windows)
This assumes both foo.c
and the library generated
above are in the current working folder.