Main Content

Call C/C++ from MATLAB

R2026b
Directly call C and C++ library functionality from MATLAB®

If 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).

Categories

Related Information