/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

level

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

Remarks

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

Operating system /target level Switches Activated
Windows 2000 NT50 /Oicf /error all /robust
Windows XP NT51 /Oicf /error all /robust /protocol all
Windows Vista NT60 /Oicf /error all /robust /protocol all
Windows 7 NT61 /Oicf /error all /robust /protocol all
Windows 8 NT62 /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 level Features
NT50 /robust
[message]
[async]
[async_uuid]
[notify] in /Oicf mode
[encode] or [decode] in /Oicf mode
NT51 /protocol 64-bit support
[partial_ignore]
[force_allocate]
NT60 Forced complex structure marshalling
Context handles in an array or structure
[range] support for unsized strings
[type_strict_context_handle]
NT61 Direct COM stub calls for interfaces with less than 32 methods requires linking COM stubs with OLE32.DLL.
NT62 ARM support
WinRT support

Examples

midl /target NT50

See also

General MIDL Command-line Syntax

/osf