Partager via


/CLRIMAGETYPE (Specify Type of CLR Image) 

/CLRIMAGETYPE:{IJW|PURE|SAFE}

Remarks

The linker accepts native objects as well as MSIL objects compiled with /clr, /clr:pure, or /clr:safe. When passing mixed objects in the same build, the verifiability of the resulting output file will, by default, be equal to the lowest level of verifiability of the input modules. For example, if you pass a safe and pure module to the linker, the output file will be pure. If you pass a native image and a mixed mode image (compiled with /clr), the resulting image will be a mixed mode image.

/CLRIMAGETYPE lets you specify a lower level of verifiability, if that is what you need.

See /clr (Common Language Runtime Compilation) for information on using /CLRIMAGETYPE to specify that a safe executable be run under WOW64 on a 64-bit operating system, when that safe image loads a 32-bit resource.

When running an .exe that was compiled with /clr or /clr:pure on a 64-bit operating system, the application will be run under WOW64, which allows a 32-bit application to run on a 64-bit operating system. By default, an .exe compiled with /clr:safe will be run using the operating system's 64-bit support. However, it is possible that your safe application loads a 32-bit component. In that case, a safe image running under the operating system's 64-bit support will fail when it loads the 32-bit application. To ensure that a safe image continues to run when it loads a 32-bit on a 64-bit operating system, you must use the /CLRIMAGETYPE (Specify Type of CLR Image) linker option to change the metadata (.corflags), marking it to be run under WOW64 (and substituting your own entry symbol):

cl /clr:safe t.cpp /link /clrimagetype:pure /entry:?main@@$$HYMHXZ /subsystem:console

For information on how to determine the CLR image type of a file, see /CLRHEADER.

To set this linker option in the Visual Studio development environment

  1. Open the project's Property Pages dialog box. For details, see How to: Open Project Property Pages.

  2. Expand the Configuration Properties node.

  3. Expand the Linker node.

  4. Select the Advanced property page.

  5. Modify the CLR Image Type property.

To set this linker option programmatically

See Also

Reference

Setting Linker Options
Linker Options