The Library Compiler app generates the type-safe API, when you build your assembly, if the correct options are selected.
Create a Library Compiler project.
Select .NET Assembly from the Type list.
Expand the Additional Runtime Settings section.
In the Type-Safe API section, do the following:
Select Enable Type-Safe API.
In the Interface assembly field, specify the location of the type-safe/WCF interface assembly that you built.
Select the desired interface from the .NET interface drop-down box.
Tip
If the drop-down is blank, the Library Compiler app may have been unable to find any .NET interfaces in the assembly you selected.
Specify the name of the class you want the generated API to wrap, in the Wrapped Class field.
Note
Leave the Namespace field blank.
Build the project by clicking the Package button.
To generate the type-safe API with your component using mcc, do
the following:
Build the component by entering this command from MATLAB®:
mcc -v -B 'dotnet:AddOneComp,Mechanism,3.5,private,local'
addOne
See the mcc reference page for
details on the options specified.
Generate the type-safe API by entering this command from MATLAB:
ntswrap -c AddOneComp.Mechanism -i IAddOne -a IAddOne.dll
where:
-c specifies the namespace-qualified name of
the .NET assembly to wrap with a type-safe API. If the assembly is
scoped to a namespace, specify the full namespace-qualified name
(AddOneComp.Mechanism in the example).
Because no namespace is specified by ntswrap, the
type-safe interface class appears in the global namespace.
-i specifies the name of the .NET interface
that defines the type-safe API. The interface name is usually
prefixed by an I.
-a specifies the absolute or relative path to
the assembly containing the .NET statically-typed interface,
referenced by the -i switch.
Tip
If the assembly containing the .NET interface
IAddOne is not in the current folder,
specify the full path.
Caution
Not all arguments are compatible with each other. See the ntswrap for details
on all command options.