C++ Shared Library Integration
MATLAB Compiler SDK™ provides two ways to deploy MATLAB functions within C++ applications:
Deploy to C++ Applications using MATLAB Data API (C++11) (since R2018a)
Deploy to C++ Applications using
mwArray
API (C++03)
Deploying MATLAB code to a C++ application using the MATLAB Data API is the newer and more modern of the two options and offers the following advantages:
Data copy operations are minimized.
You do not need to explicitly manage the life-cycle of the MATLAB Runtime instance and library of MATLAB functions in the archive since the C++ API provides a fail-safe way to terminate them.
The runtime instance can run either in-process or out-of-process with respect to the C++ application, and deployed MATLAB functions can be executed either synchronously or asynchronously.
Support for C++11 functionality, type-safety, and multi-thread-safety.
Support for strong types in MATLAB code.
Complex data is stored in the same interleaved format used by MATLAB internally since R2018a and by the C++ language. This eliminates the need for internal conversion.
bat365® recommends deploying to C++ using the MATLAB Data API. However, to select the right deployment option for your project, see Choosing C++ Deployment Option.
MATLAB Runtime must be installed and setup on the machine running the C++ application. For details, see Install and Configure MATLAB Runtime.
Categories
- Deploy to C++ Applications Using MATLAB Data API (C++11)
Integrate packaged MATLAB functions into C++ applications using the MATLAB Data API
- Deploy to C++ Applications Using mwArray API
(C++03)
Integrate packaged MATLAB functions into C++ applications using themwArray
API for data exchange