|Important||This document may not represent best practices for current development, links to downloads and other resources may no longer be valid. Current recommended version can be found here. ArchiveDisclaimer|
/CLRIMAGETYPE (Specify Type of CLR Image)
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.
Seefor 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 thelinker 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.
To set this linker option in the Visual Studio development environment
Open the project's Property Pages dialog box. For details, see.
Expand the Configuration Properties node.
Expand the Linker node.
Select the Advanced property page.
Modify the CLR Image Type property.
To set this linker option programmatically