Main Content


Generates type-safe API


ntswrap.exe [-c namespace.class] [-i interface_name] [-a assembly_name]


Available as a MATLAB® function or Windows console executable.

ntswrap.exe [-c namespace.class] [-i interface_name] [-a assembly_name] accepts command line switches in any order.

Run ntswrap for Generate the Type-Safe API with an Assembly with a MATLAB Compiler SDK™ generated assembly.



-a .NET_native_interface.dll

Absolute or relative path to assembly containing .NET statically-typed interface, referenced by -i switch.

-b MATLAB_NET_assembly.dll

Path to folder containing .NET assembly that defines component referenced by -c switch

-c component_class_name

Namespace-qualified name of assembly identified by path in -b switch


Enables debugging of the type-safe API assembly

Incompatible with -s.

-i interface_name

Namespace-qualified name of user-supplied interface in assembly identified by path in -a switch


Keep generated type safe API source code; do not delete after processing

-n namespace_containing_generated_type-safe_API_class

Optional. If specified, places generated type-safe API in specified namespace

-o output_folder

Optional. If specified, all output files will be written to specified, preallocated folder


Generate source code only; do not compile type-safe API source into an assembly

-v vx.x

Version of Microsoft® .NET Framework (csc compiler) used to generate type-safe API assembly (for example v4.0)

Incompatible with -s.

-w name_of_generated_type-safe_API_wrapper_class_and_assembly

Optional. If specified, overrides default name of generated type-safe API class and assembly



.NET binary containing type-safe API class. Requires ComponentNative.dll,Interface.dll and MWArray.dll


Optional output, produced by -s and -k


ntswrap.exe -c AddOneComp.Mechanism 
            -i IAddOne 
            -a IAddOne.dll 

Issuing this command generates a type-safe API for the MATLAB Compiler SDK class Mechanism in the namespace AddOneCompNative. By default, ntswrap compiles the source code into an assembly MechanismIAddOne.dll.

If ntswrap is called as a MATLAB function, all the input arguments should be specified as character arrays or string type. For example,

ntswrap('-c', 'AddOneComp.Mechanism', ...
        '-a', 'IAddOne.dll', ...
        '-i', 'IAddOne');
Introduced in R2011a