Main Content

ntswrap

Generate type-safe API

Description

example

ntswrap('-a','interfaceAssemblyFile','-c','componentName.className','-i','interfaceName') generates an assembly that contains the type-safe API for the MATLAB® Compiler SDK™ .NET assembly componentName wrapped in the class className.

example

ntswrap('-a','interfaceAssemblyFile','-c','componentName.className','-i','interfaceName','-s','-k') generates the source code for the type-safe API instead of an assembly.

example

ntswrap(___,'-b','assemblyFile','-d','-n','Namespace.Class','-o','outputDir','-v','version','-w','assemblyName') generates the type-safe API with additional options specified using one or more of the listed arguments. Options include the Microsoft® .NET Framework version, assembly and class names, and output directory.

Examples

collapse all

Generate an assembly that contains a type-safe API using a .NET assembly and a type-safe interface DLL.

Create the type-safe interface IMultiply.dll and .NET assembly Multiply.dll using the procedure outlined in Implement Type-Safe Interface and Integrate into .NET Application.

Generate the type-safe API using ntswrap.

ntswrap('-c','Multiply.Arithmetic', ...
        '-a','IMultiply.dll', ...
        '-i','IMultiply');

This syntax generates the .NET binary ArithmeticIMultiply.dll that contains a type-safe API for the MATLAB Compiler SDK class Arithmetic in the namespace Multiply.

Generate source code for a type-safe API using a .NET assembly and a type-safe interface DLL.

Create the type-safe interface IMultiply.dll and .NET assembly Multiply.dll using the procedure outlined in Implement Type-Safe Interface and Integrate into .NET Application.

Generate the type-safe API using ntswrap. Use the additional arguments -s and -k to generate source code instead of an assembly.

ntswrap('-c','Multiply.Arithmetic', ...
        '-a','IMultiply.dll', ...
        '-i','IMultiply', ...
        '-s','-k');

This syntax generates the source code file ArithmeticIMultiply.cs for the type-safe API.

Input Arguments

collapse all

Assembly that contains the statically typed interface referenced by the -i argument, specified as a character vector or string vector that contains the relative or absolute path to the assembly.

Example: '-a','IMyInterface.dll'

Data Types: char | string

The .NET assembly that defines the component referenced by the -c argument, specified as a character vector that contains the relative or absolute path to the assembly. Use this option if ntswrap cannot find the specified .NET assembly.

Example: '-b','MATLAB_NET_assembly.dll'

Data Types: char | string

Component class namespace of the .NET assembly, specified as a period-separated list that consists of the component name followed by the class name. If the assembly is scoped to a namespace, specify the full namespace-qualified name.

Example: '-c','MydotNETComp.MyClass'

Data Types: char | string

Enable debugging of the type-safe API assembly. This option is incompatible with -s.

Interface name, specified by a character vector or string scalar. The interface name is usually prefixed by an I and correlates to the interface assembly identified by the -a option.

Example: '-i','IMyInterface'

Data Types: char | string

Keep the generated type-safe API source code. If this argument is omitted, the source code is deleted after processing. This argument is optional.

Namespace containing the type-safe API class, specified as a character vector or string scalar. Use this option to override the namespace specified by the -c argument. This argument is optional.

Example: '-n','Sample.Sample'

Data Types: char | string

Path to the output folder where the build files are saved, specified as a character vector or a string scalar that contains the relative or absolute path. This argument is optional.

Example: '-o','D:\Documents\MATLAB\work\TypeSafeProject'

Data Types: char | string

Generate source code only; do not compile type-safe API source into an assembly. This argument is optional.

Microsoft .NET Framework version (csc compiler) used to generate the type-safe API assembly, specified as a character vector or string scalar. This argument is optional and is incompatible with -s.

Example: '-v','v4.0'

Data Types: char | string

Name of the generated type-safe API class and assembly, specified as a character vector or string scalar. Use this option to override the default name. This argument is optional.

Example: '-w','TypeSafeMultiply'

Data Types: char | string

Tips

  • To use ntswrap from the Windows® command prompt, use the following syntax:

    ntswrap.exe -a interfaceAssembly -c className -i interfaceName

    ntswrap.exe is located in matlabroot\toolbox\dotnetbuilder\bin\<arch>.

Introduced in R2011a