After creating the definition file
define
using
libName
.mlxclibgen.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.
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:
To treat all const
character pointers in the library as
null-terminated C strings, set the 'TreatConstCharPointerAsCString' argument to true
.
To treat all object pointers in the library as scalars, set the 'TreatObjectPointerAsScalar' argument to true
.
However, when you validate the library definition, you might get errors about duplicate MATLAB® signatures. To resolve these errors, see 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
define
, type:libname
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.
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.
clibgen.buildInterface
| clibgen.generateLibraryDefinition