mex
- : mex
[options] file …¶ - :
mexBuildOutput =mex(…)¶ - : mex
("-setup")¶ - : mex
("-setup", compiler)¶ Compile C, CXX or Fortran source files into a MEX binary.
The arguments are the options of the compiler driver followed by the source files; all of them are character strings and are passed on to the
nexus_mexdriver (and from there into the underlying compiler / linker invocation). The output name usesmexext(.mexa64 / .mexw64), matching MATLAB R2026a. An error is raised when the driver reports a failure and no output argument is requested.With an output argument,
mexreturns a mexBuildOutput struct with fieldsExitCodeandMessages(compiler/driver text). A non-zeroExitCodemeans the build failed; the call does not raise an error in that case.mex ("-setup")lists the compilers found onPATHand writes a mexopts configuration underprefdir.mex ("-setup", "g++")selects that compiler in mexopts.Options match MATLAB R2026a
mexcommand syntax, including:-vEcho the compiler and linker commands (verbose).
-gKeep debugging information (passed as -g).
-OOptimise the build (passed as -O).
-Dname[=value]Define a preprocessor macro for the compile step.
-IpathnameAdd pathname to the include search path.
-LpathnameAdd pathname to the library search path.
-lnameLink against library name.
-R2018aInterleaved complex API (defines MX_HAS_INTERLEAVED_COMPLEX to 1).
-R2017bSeparate complex API (defines MX_HAS_INTERLEAVED_COMPLEX to 0).