Crear una interfaz de MATLAB a una biblioteca de C/C++
R2026bPuede crear (publicar) una interfaz de MATLAB a una biblioteca de C o C++ utilizando código de MATLAB que usted mantiene. Especifique los encabezados y símbolos que se deben incluir, ajuste solo las definiciones que MATLAB no puede inferir y vuelva a crear la interfaz de forma consistente en todas las plataformas y actualizaciones de bibliotecas. Para obtener una visión general de la interfaz, consulte How to Publish a MATLAB Interface to a C/C++ Library.
Como alternativa, llame a clibPublishInterfaceWorkflow para obtener una guía paso a paso de cómo crear una interfaz específica para una plataforma.
Para obtener información sobre cómo llamar a las funciones en la biblioteca desde MATLAB, consulte Utilizar una interfaz de MATLAB predefinida a una biblioteca de C/C++.
Antes de R2026b: Las opciones para publicar una interfaz son llamar a clibPublishInterfaceWorkflow para utilizar un script de flujo de trabajo o crear un archivo de definición para la biblioteca con clibgen.generateLibraryDefinition. Para obtener más información, consulte Cómo publicar una interfaz de MATLAB a una biblioteca de C/C++ (R2026a).
Clases
clibgen.api.InterfaceConfiguration | Specify configuration for generating MATLAB interface to C/C++ library (Desde R2026b) |
clibgen.api.InterfaceDefinition | Inspect, customize, and build MATLAB interface definition for C/C++ library (Desde R2026b) |
Funciones
clibPublishInterfaceWorkflow | Create live script to publish platform-specific interface for C/C++ library (Desde R2023a) |
clibgen.generateLibraryDefinition | (Not recommended) Create definition file for C/C++ library |
clibgen.buildInterface | (Not recommended) Create interface to C/C++ library without definition file |
Tareas de Live Editor
| Generar interfaz de C++ | Configure and generate MATLAB interface to C/C++ library (Desde R2023a) |
Espacios de nombres
clibgen.api | Summary of programmatic workflow objects for publishing MATLAB interface to C/C++ library (Desde R2026b) |
clibgen | (Not recommended. Instead use objects in the clibgen.api
namespace.) Classes to publish MATLAB interface to C++ library using the
clibgen.generateLibraryDefinition function |
Temas
Publicar una interfaz de MATLAB
- How to Publish a MATLAB Interface to a C/C++ Library
Outline for publishing an interface to a C/C++ library.
- Requirements for Building a MATLAB Interface to C/C++ Libraries
Necessary steps to successfully call functions in external, compiled C/C++ libraries from MATLAB.
Definir y personalizar
- Define MATLAB Interface for C/C++ Library
Generate and edit the MATLAB
clibgen.api.InterfaceDefinitionobject to customize and define the interface. - Publish Help Text for MATLAB Interface to C/C++ Library
Provide documentation for end-users of a MATLAB interface to a C/C++ Library.
Compartir su interfaz
- Distribute MATLAB Interface to C/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.
Solución de problemas
Build C/C++ Library Interface and Review Contents
When you build a MATLAB interface to a C/C++ library, you can review the contents of the generated interface.
C/C++ library features not supported in MATLAB.
Troubleshooting C/C++ Library Definition Issues
Information for resolving errors when publishing a MATLAB interface to a C/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/C++ Library Run-Time Issues
Resolve unexpected run-time errors when calling functions in a published MATLAB interface to a C/C++ compiled library.
Troubleshooting Calls to C/C++ Library Functions
Resolve unexpected issues when calling functions in a C/C++ compiled library.
Debug C++ Library from MATLAB Interface
How to build a debug version of a MATLAB interface to a C++ library.