How to Publish a MATLAB Interface to a C++ Library
You can publish an interface using a workflow script or from the MATLAB® command line. For requirements to build an interface, see Requirements for Building Interface to C++ Libraries.
Publish with Workflow Script
- Call the - clibPublishInterfaceWorkflowfunction to open the template workflow script Publish MATLAB interface to C++ library.
- Follow these steps in the live script. Each step has a code section to run. - Step 1: GENERATE — Generate a library definition file using the Generate C++ Interface Live Editor task. - 1a: Restore library definition — Optional step to recreate workspace variables across MATLAB sessions. For more information, see Restore Library Definition. 
 
- Step 2: DEFINE — Edit the library definition file to define missing - DIRECTION,- SHAPE, or- MLTYPEparameters, or to customize the library help. For more information, see Define Missing DIRECTION Parameter, Define Missing SHAPE Parameter, Define Missing MLTYPE Parameter, and Publish Help Text for MATLAB Interface to C++ Library.- 2a: Confirm edits and run summary — Display the MATLAB signatures for each supported construct of the C++ library. 
 
- Step 3: BUILD — Build the MATLAB interface to the C++ library file from the library definition file. For more information, see Build C++ Library Interface and Review Contents. 
- Step 4: TEST - 4a: Set up and copy run-time libraries — Copy run-time library files to the interface library folder. If your library has additional run-time dependencies, specify them in this section. For more information, see Set Up and Copy Run-Time Libraries. 
- 4b: Enable out-of-process execution mode — Setup to call the interface library out-of-process which prevents a MATLAB restart if the definition file needs to change. For more information, see Load Out-of-Process C++ Library. 
- 4c: Call help on interface library — Display help for the interface library. 
- 4d: Write code to call and test interface library — Call your library using the syntax - clib.followed by the library construct.- libraryName
- 4e: Unload out-of-process library — Unload the out-of-process MATLAB library. For more information, see Unload Out-of-Process C++ Library. 
 
 
- To share your interface with MATLAB users, see Distribute MATLAB Interface to C++ Library. 
Publish at Command Line
You can publish an interface from the command line by calling the clibgen.generateLibraryDefinition function. The outline for publishing an
        interface includes these steps:
- For Step 1: Generate, see - clibgen.generateLibraryDefinition.
- For Step 2: Define, see Define MATLAB Interface for C++ Library. 
- For Step 3: Build, see Build C++ Library Interface and Review Contents. 
- For Step 4: Test, see Call Functions in Interface to matrixOperations C++ Compiled Library on Windows or Call Functions in Interface to matrixOperations C++ Compiled Library on Linux. 
- For Step 5: Distribute, see Distribute MATLAB Interface to C++ Library. 
Examples to Publish an Interface
See Also
clibgen.generateLibraryDefinition | build
Topics
- Requirements for Building Interface to C++ Libraries
- Define MATLAB Interface for C++ Library
- Publish Help Text for MATLAB Interface to C++ Library
- Build C++ Library Interface and Review Contents
- Call Functions in C++ Compiled Library
- Distribute MATLAB Interface to C++ Library
- Create and Share Toolboxes
- Limitations to C/C++ Support