/target switch

The /target switch enables the MIDL compiler to enable optimizations available only on recent versions of Windows. The /target switch automatically activates additional switches.

midl /target level

Switch Options


Specifies the target level, such as NT50, NT51, NT60, NT61, or NT62.


The /target switch automatically activates additional switches, based on the operating system, as specified in the following table:

Operating system/target levelSwitches Activated
Windows 2000NT50/Oicf /error all /robust
Windows XPNT51/Oicf /error all /robust /protocol all
Windows VistaNT60/Oicf /error all /robust /protocol all
Windows 7NT61/Oicf /error all /robust /protocol all
Windows 8NT62/Oicf /error all /robust /protocol all


To ensure a stub runs on the system specified by the /target switch, MIDL issues an error when a feature available only on a more recent version of Windows is present. The following table specifies the minimum /target level required to enable the feature. Higher target levels include all features from lower target levels.

Minimum required /target levelFeatures





[notify] in /Oicf mode

[encode] or [decode] in /Oicf mode


/protocol 64-bit support




Forced complex structure marshalling

Context handles in an array or structure

[range] support for unsized strings



Direct COM stub calls for interfaces with less than 32 methods requires linking COM stubs with OLE32.DLL.


ARM support

WinRT support



midl /target NT50

See also

General MIDL Command-line Syntax