Main Content
Use Prebuilt MATLAB Interface to C++ Library
To call a function in a C++ library, use the MATLAB®
clib
namespaceIf 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
clibArray | Create MATLAB clib array for C++ library functions (Since R2020a) |
clibConvertArray | Convert MATLAB fundamental or struct array to MATLAB array of C++ objects (Since R2020a) |
clibConfiguration | Change execution mode of C++ library interface (Since R2023a) |
CLibraryConfiguration | C++ library interface environment information (Since R2023a) |
clibIsNull | Determine if C++ object is null |
clibIsReadOnly | Determine if C++ object is read-only |
clibRelease | Release C++ object from MATLAB |
underlyingValue | Underlying numeric value for C++ enumeration object created in MATLAB |
Topics
Call C++ Functions
- Call Functions in C++ Compiled Library
To call a function in the library, use the MATLABclib
namespace. - Call Functions in Windows Interface to C++ Compiled Library
How to call functions in a Windows® interface to thematrixOperations
C++ compiled library example. - Call Functions in Linux Interface to C++ Compiled Library
How to call functions in a Linux® interface to thematrixOperations
C++ compiled library example. - Use Function Type Arguments
How to pass function type arguments to C++ functions. - Use Function and Member Function Templates
How to call and customize names of functions derived from C++ templates. - Use C++ Objects and Functions in parfor Loops
How to take advantage of parallel computing resources using a MATLAB interface to a C++ compiled library.
Represent C++ Arrays and Objects
- Represent C++ Arrays Using MATLAB Objects
How to create a MATLAB clib array or convert a MATLAB array to pass as a C++ function parameter. - C++ Language Opaque Objects
How MATLAB handles opaque objects. - C++ Names That Are Invalid in MATLAB
MATLAB automatically renames classes, member functions, non-member functions, and enumerations with C++ names that are invalid in MATLAB by using thematlab.lang.makeValidName
function.
Configure C++ Library Interface
- Set Run-Time Library Path for C++ Interface
If the C++ library has a compiled library file, then that file and its dependencies must be on your system path or run-time search path (rpath). - Load C++ Library In-Process or Out-of-Process
Execute C++ functions in processes that are separate from the MATLAB process. - Display Help for MATLAB Interface to C++ Library
Display information about the members of MATLAB interface.
Troubleshooting
Troubleshooting MATLAB Interface to C++ Library Issues
MATLAB searches for the library interface file on the MATLAB path.
C/C++ library features not supported in MATLAB.
Using C++ exceptions in MATLAB.