Main Content

Use Prebuilt MATLAB Interface to C++ Library

To call a function in a C++ library, use the MATLAB® clib namespace

If you have a published MATLAB interface to a C++ shared library, then you can use these classes and functions directly in MATLAB, passing data back and forth between MATLAB and C++.

Functions

clibArrayCreate MATLAB clib array for C++ library functions
clibConvertArrayConvert MATLAB fundamental or struct array to MATLAB array of C++ objects
clibConfigurationSet run-time configuration parameters for C++ library interface (Since R2023a)
CLibraryConfigurationC++ library interface environment information (Since R2023a)
clibIsNullDetermine if C++ object is null
clibIsReadOnlyDetermine if C++ object is read-only
clibReleaseRelease C++ object from MATLAB
underlyingValueUnderlying numeric value for C++ enumeration object created in MATLAB

Topics

Configure C++ Library Interface

Use C++ Library in MATLAB

Troubleshooting

Troubleshooting MATLAB Interface to C++ Library Run-Time Issues

Resolve unexpected run-time errors when calling functions in a published MATLAB interface to a C++ shared library.

Troubleshooting Calls to C++ Library Functions

Resolve unexpected issues when calling functions in a C++ shared library.

Limitations to C/C++ Support

C/C++ library features not supported in MATLAB.

Handling Exceptions

Using C++ exceptions in MATLAB.

Featured Examples