[.NET] /clr compiler options

来源:互联网 发布:mysql如何删除索引 编辑:程序博客网 时间:2024/05/21 08:43
 

The /clr compiler option has several variations. Each one applies a different set of restrictions on what you are allowed to code within a project. For interop between managed and unmanaged code, the /clr option that produces a mixed assembly is the most useful. Table below presents a summary of the available options.

 

Option

Description

Notes

/clr

Mixed assembly

Produces an assembly that can contain managed and nmanaged code and data. The assembly is capable of being referenced from .NET code as well as linked into native C++ code.

/clr:pure

Managed-only assembly

Produces an assembly containing only managed code compiled to Microsoft Intermediate Language (MSIL). The assembly can be referenced from any .NET

code, but cannot be used from native C++ code. The assembly is allowed to use unmanaged data types, but only managed functions and methods are allowed.

/clr:safe

Managed-only assembly

enabled for code access security

Produces an assembly containing only managed code compiled to MSIL. This type of assembly can be checked at runtime to determine if it meets the security settings in effect. Use of any native data types and methods is prohibited. No interop features are allowed.

/clr:oldSyntax

Managed Extensions for C++

Enables the older Managed Extensions for C++ syntax that was used prior to Visual Studio 2005.

 

原创粉丝点击