|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.|
/CLRUNMANAGEDCODECHECK (Add SupressUnmanagedCodeSecurityAttribute)
/CLRUNMANAGEDCODECHECK specifies whether the linker will applyto linker-generated PInvoke calls from managed code into native DLLs.
By default, /CLRUNMANAGEDCODECHECK is in effect, which means SuppressUnmanagedCodeSecurityAttribute is applied to linker-generated PInvoke calls. Specify /CLRUNMANAGEDCODECHECK:NO to not apply this attribute.
The linker only adds the attribute to objects that are compiled with /clr or /clr:pure. The linker does not generate PInvoke calls in objects compiled with /clr:safe. For more information, see.
A PInovke call is generated by the linker when the linker can’t find a managed symbol to satisfy a reference from a managed caller but can find a native symbol to satisfy that reference. For more information on PInvoke, see.
Note that if you usein your code, you should explicitly set /CLRUNMANAGEDCODECHECK. It is potential security vulnerability if an image contains both the SuppressUnmanagedCodeSecurity and AllowPartiallyTrustedCallers attributes.
Seefor more information on the implications of using SuppressUnmanagedCodeSecurityAttribute.
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 Unmanaged Code Check property.
To set this linker option programmatically