Main Content

Steps 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 clibPublishInterfaceWorkflow to open a template live script for publishing a MATLAB interface to a C++ library. 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 MLTYPE parameters, 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.libraryName followed by the library construct.

    • 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:

Examples to Publish an Interface

See Also

|

Related Topics