Define MATLAB Interface for C++ Library

Complete Definitions

After creating the definition file definelibName.mlx using clibgen.generateLibraryDefinition, you might have to modify the contents to include functionality in the interface. Use the Live Editor to modify the file. For more information, see Define Missing Information for MATLAB Signatures.

Auto-Define Arguments

You can direct MATLAB to auto-define the type and shape of specific argument types using clibgen.generateLibraryDefinition and clibgen.buildInterface name-value pair arguments. The options are:

However, when you validate the library definition, you might get errors about duplicate MATLAB® signatures. To resolve these errors, see Reconcile MATLAB Signature Conflicts.

Reconcile MATLAB Signature Conflicts

After generating and editing a library definition file, there might be two or more functions or other constructs with identical MATLAB signatures. To check for this conflict, validate the definition file. For example, for the definition file definelibname, type:

definelibname

If there is a conflict, MATLAB displays an error with a link to the code in the definition file. To resolve the conflict, choose one of the following:

  • Revise the defineArgument or defineOutput arguments to create a unique MATLAB signature. The conflict occurs when there are multiple overloaded functions and you specify the same argument parameters. See Define Missing Information for MATLAB Signatures.

  • Remove one of the functions by commenting out the definition of the construct. The conflict might occur when you use one of the clibgen.generateLibraryDefinition name-value pair arguments to automatically convert all cases of a particular type. You also can remove an overloaded function.

After modifying the definition file, rerun the file to validate your edits.

Customize Content

Review the renaming scheme used by MATLAB to replace invalid names. For more information, see C++ Names That Are Invalid in MATLAB.

Review auto-generated help. MATLAB automatically copies some C++ comments into Description and DetailedDescription arguments. You can modify or replace this content, which is the basis of the doc command for end-users.

See Also

|

Related Topics