Call C/C++ from MATLAB
R2026bIf you have a C or C++ compiled library that exports functionality for use by other applications, you can call its classes and functions directly from MATLAB. To get started, see Build MATLAB Interface to C/C++ Library. The person who creates this interface is called a publisher. You can package the interface and share it with MATLAB end users.
To call the library functionality in MATLAB, see Use Prebuilt MATLAB Interface to C/C++ Library.
To call functions in a C compiled library from MATLAB R2021b and earlier, use the calllib
function. For information, see Call C from MATLAB. This feature
works best with C-only libraries.
To create MATLAB functions written in C or C++, see Write C++ Functions Callable from MATLAB (MEX Files).
Publish MATLAB Interface to C++ Library
Categories
- Build MATLAB Interface to C/C++ Library
Programmatically create a MATLAB interface to a C or C++ library
- Use Prebuilt MATLAB Interface to C/C++ Library
To call a function in a C or C++ library, use the MATLABclibnamespace