Main Content

C++ mwArray API Shared Library Integration

Create and integrate packaged MATLAB® functions into C++ applications using the mwArray API

The C++ mwArray API supports only C++03 functionality. C++ shared libraries that use the mwArray API have an interface that uses C-style functions to initialize the MATLAB Runtime, load the packaged MATLAB functions into the MATLAB Runtime, and manage data that is passed between the C++ driver code and MATLAB Runtime. These functions are described under C/C++ API. The functions listed under C++ mwArray API are specific to the mwArray API and cannot be used for shared libraries created for other APIs.

Functions C++ shared library for building C++ shared libraries
mbuildCompile and link source files against MATLAB generated shared libraries


mclmcrInitializeInitialize the MATLAB Runtime proxy library
mclInitializeApplicationSet up application state shared by all MATLAB Runtime instances created in current process
mclTerminateApplicationClose MATLAB Runtime-internal application state
<library>Initialize[WithHandlers]Initialize MATLAB Runtime instance associated with library
<library>TerminateFree all resources allocated by MATLAB Runtime instance associated with library
mclRunMainMechanism for creating identical wrapper code across all platforms
mclIsMCRInitializedDetermine if MATLAB Runtime has been properly initialized
mclWaitForFiguresToDieEnable deployed applications to process graphics events, enabling figure windows to remain displayed
mclGetLastErrorMessageLast error message from unsuccessful function call
mclGetLogFileNameRetrieve name of log file used by MATLAB Runtime
mclIsJVMEnabledDetermine if MATLAB Runtime was started with instance of Java Virtual Machine (JVM)
mclIsNoDisplaySetDetermine if -nodisplay mode is enabled

C++ mwArray API

mwArrayClass used to pass input/output arguments to C++ functions generated by MATLAB Compiler SDK
mwExceptionException type used by the mwArray API and the C++ interface functions
mwStringString class used by the mwArray API to pass string data as output from certain methods


Create and Implement a C++ mwArray API Shared Library

Generate a C++ mwArray API Shared Library and Build a C++ Application

Create a C++ mwArray API shared library from MATLAB code and implement it with sample C++ driver code.

Integrate a C++ Shared Library with a C++ Driver Application

Configure the mbuild Options File

How to configure the mbuild options file.

Call MATLAB Compiler SDK API Functions from C/C++

Use MATLAB Compiler SDK™ API functions for C/C++ to assimilate shared libraries in driver code.

Integrate C++ Shared Libraries

Create and distribute C++ shared libraries that use the mwArray API.

Use Multiple Shared Libraries in Single Application

Use multiple generated shared libraries in a single C/C++ application.

Mac OS X

Write Applications for macOS

Write deployable C++ applications specifically for macOS.

MATLAB Runtime

Install and Configure MATLAB Runtime

Install, configure, and uninstall MATLAB Runtime.

Set MATLAB Runtime Path for Deployment

Define paths for machines where you want to run applications generated with MATLAB Compiler™ or MATLAB Compiler SDK.

MATLAB Runtime Startup Options

Set MATLAB Runtime options, such as -nojvm, -nodisplay, or -logfile.

MATLAB Runtime Component Cache and Deployable Archive Embedding

Override the default archive embedding behavior, and use MATLAB Runtime component cache.