Main Content

C++ MATLAB Data API Shared Library Integration

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

Shared libraries that use the MATLAB Data API have a generic interface that uses modern C++ semantics. The interface supports C++11 functionality and has several advantages over the mwArray API, including type-safety and multithread-safety. The interface provides functions that ensure correct initialization and termination of applications. It can be run either in-process or out-of-process and can call functions asynchronously. For more information, see Workflow to Integrate with a C++ Shared Library that Uses the MATLAB Data API. For an example, see Generate a C++ MATLAB Data API Shared Library and Build a C++ Application.

Functions

compiler.build.cppSharedLibraryCreate C++ shared library
compiler.build.CppSharedLibraryOptionsOptions for building C++ shared libraries
mbuildCompile and link source files against MATLAB generated shared libraries

C/C++ API

matlab::cpplib::initMATLABApplicationStart the MATLAB Runtime and initialize its application state
matlab::cpplib::runMainExecute a function with its input arguments within the main function
matlab::cpplib::convertUTF8StringToUTF16StringConvert UTF-8 string to UTF-16 string
matlab::cpplib::convertUTF16StringToUTF8StringConvert UTF-16 string to UTF-8 string
matlab::cpplib::initMATLABLibraryInitialize a library of MATLAB functions packaged in a deployable archive file
matlab::cpplib::initMATLABLibraryAsyncInitialize a library of MATLAB function asynchronously
matlab::cpplib::MATLABLibrary::fevalExecute a MATLAB function from a deployable archive
matlab::cpplib::MATLABLibrary::fevalAsyncExecute a MATLAB function from a deployable archive asynchronously
matlab::cpplib::MATLABLibrary::waitForFiguresToCloseWait for all figures to close

Topics

Create and Implement a C++ MATLAB Data Array API Shared Library

Workflow to Integrate with a C++ Shared Library that Uses the MATLAB Data API

Workflow to integrate with a C++ shared library that uses the MATLAB Data API.

Generate a C++ MATLAB Data API Shared Library and Build a C++ Application

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

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

Writing C++ Driver Code Using the C++ MATLAB Data Array API

Guidelines on writing C++ driver code using the generic interface for integration with C++ shared libraries that use the MATLAB Data API.

Configure the mbuild Options File

How to configure the mbuild options file.

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 Run-Time 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.