Main Content

clibPublishInterfaceWorkflow

Publish interface for C++ library in the Live Editor

Since R2023a

    Description

    If you have a C or C++ shared library that exports functionality that can be called from another application, then you can use those classes and functions directly in MATLAB®. To get started, you must first build an interface to the library to use to call the functionality in MATLAB. Someone who creates this interface is called a publisher. You can package the interface and share it with a MATLAB end user. For information about calling these C++ functions from MATLAB, see Use Prebuilt MATLAB Interface to C++ Library.

    clibPublishInterfaceWorkflow creates a template live script to publish a MATLAB interface for a C++ library. Use this script to walk through the publishing steps to:

    1. Generate the library definition file using the Generate C++ Interface task.

    2. Define missing functionality by editing the library definition file.

    3. Build the MATLAB interface to the C++ library file from the library definition.

    4. Test the interface by setting up run-time libraries and calling library functions.

    For more information, see Steps to Publish a MATLAB Interface to a C++ Library.

    example

    Examples

    collapse all

    Identify the C++ files that define your library.

    Call the clibPublishInterfaceWorkflow function in the MATLAB Command Window to create the live script.

    clibPublishInterfaceWorkflow

    In the dialog box that appears, specify a file name and location to save the live script. Then, follow the instructions in each section of the script to generate, define, build, and test the library interface.

    For examples, see:

    Alternative Functionality

    clibgen.generateLibraryDefinition Function

    Use the clibgen.generateLibraryDefinition and build command line functions to publish an interface using name-value arguments.

    Version History

    Introduced in R2023a