3

在 VC++ .Net 中,Clr/Safe ( /clr:safe) 和 Clr/Pure ( /clr:pure) 是什么意思?

4

2 回答 2

3

文档

/clr:pure生成没有本机可执行代码的仅限 Microsoft 中间语言 (MSIL) 的输出文件。但是,它可以包含编译为 MSIL 的本机类型。

/clr:safe生成仅 MSIL(无本机可执行代码)、可验证的输出文件。/clr:safe 启用验证诊断(PEVerify Tool (Peverify.exe))。

于 2010-08-21T06:59:00.803 回答
0

I don't think that's enough information. It seemed from the other answer that it was just type checking. It seems from this doc that it's a lot more than that.

When /clr (not /clr:pure or /clr:safe) is used and __clrcall is not used, taking the address of a function always returns the address of the native entry point function. When __clrcall is used, the native entry point function is not created, so you get the address of the managed function, not an entry point thunk function. For more information, see Double Thunking.

/clr (Common Language Runtime Compilation) implies that all functions and function pointers are __clrcall and the compiler will not permit a function inside the compiland to be marked anything other than __clrcall. When /clr:pure is used, __clrcall can only be specified on function pointers and external declarations.

于 2017-12-17T07:24:20.230 回答