Build MATLAB Interface to C++ Library
clibgen
namespaceTo build (publish) a MATLAB interface to a C++ library, call clibPublishInterfaceWorkflow
. For an
overview, see How to Publish a MATLAB Interface to a C++ Library.
For information about calling functions in the library from MATLAB, see Use Prebuilt MATLAB Interface to C++ Library.
Functions
clibPublishInterfaceWorkflow | Publish interface for C++ library in the Live Editor (Since R2023a) |
clibgen.generateLibraryDefinition | Create definition file for C++ library |
clibgen.buildInterface | Create interface to C++ library without definition file |
Live Editor Tasks
Generate C++ Interface | Generate definition file for C++ interface library in the Live Editor (Since R2023a) |
Namespaces
clibgen Namespace | Summary of namespaces and classes to support calling C++ library functionality from MATLAB |
Topics
How To Publish an Interface
- What Types of Files Define Your Library?
Your library might contain combinations of header files, CPP source files, and shared library files.
- How to Publish a MATLAB Interface to a C++ Library
Outline for publishing an interface to a C++ library. - Requirements for Building Interface to C++ Libraries
Requirements for calling functions in external, compiled C++ libraries from MATLAB.
Define and Customize
- Define MATLAB Interface for C++ Library
Generate and edit the MATLAB library definition file to customize and define the interface.
- Publish Help Text for MATLAB Interface to C++ Library
Provide documentation for end-users of a MATLAB interface to a C++ Library.
Share Your Interface
- Distribute MATLAB Interface to C++ Library
How to share your MATLAB interface with MATLAB users.
- C++ to MATLAB Data Type Mapping
Correspondence of MATLAB data types to C/C++ types. - Lifetime Management of C++ Objects in MATLAB
MATLAB rules for managing memory for C++ objects created in a MATLAB interface to a C++ compiled library. - Initialize Pointer Members of C++ Structures for MATLAB Interface to Library
Verify that C++ class constructors initialize pointer members.
Troubleshooting
Build C++ Library Interface and Review Contents
If library functionality is missing, the library might contain unsupported language features or data types.
C/C++ library features not supported in MATLAB.
Troubleshooting C++ Library Definition Issues
Information for resolving errors when publishing a MATLAB interface to a C++ library.
- Resolve Build Error: Multiple Redefinition Linker Errors
- Resolve Build Error: Unresolved External Symbols
- Build Error Due to Compile-Time Checks
- Errors Parsing Header Files on macOS
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.
Debug C++ Library from MATLAB Interface
How to build a debug version of a MATLAB interface to a C++ library.