If you have a C++ shared library that exports functionality that can be called from another application, then you can use these classes and functions directly in MATLAB, passing data back and forth between MATLAB and C++.
To get started, you first must publish an interface library, using the following.
A shared library file —
.dll on Windows®,
One or more header files that contain declarations of all the functions exported by the library
An import library file (optional) —
A MATLAB-supported C++ compiler
If you already have the interface, then you can call functions in the
library using the
syntax. The library must be on your system or run-time search path.
For more information, see Call Functions in C++ Shared Library.
|MATLAB definition for C++ library|
|Definition for MATLAB class corresponding to C++ class|
|Definition for MATLAB function corresponding to C++ class constructor|
|Definition for MATLAB property corresponding to public property of C++ class|
|Definition for MATLAB function corresponding to C++ class method|
|Definition for MATLAB function corresponding to C++ package function|
|Definition for MATLAB enumeration corresponding to C++ enumeration|
|Summary of packages and classes to support calling C++ library functionality from MATLAB|
Requirements for calling functions in external, shared C++ libraries from MATLAB.
Requirements for importing C++ library functionality into MATLAB.
Correspondence of MATLAB data types to C++ types.
Outline for publishing an interface to a C++ library.
This example creates a MATLAB interface to a C++ library defined in a header file.
This example creates a MATLAB interface to a C++ shared library.
How to update definitions in the MATLAB
.mlx definition file.
To call a function in the library, use the MATLAB
Display package information and method signatures for MATLAB C++ interface.
Using C++ exceptions in MATLAB.
C/C++ library features not supported in MATLAB.
Information for resolving C++ interface issues.
Work around for errors parsing header file on macOS.
How to remove C++ members containing compile-time assertions.