共用方式為


HOW TO:偵測 /clr 編譯

更新:2007 年 11 月

使用 _MANAGED_M_CEE 巨集以查看模組是否使用 /clr 進行編譯。如需詳細資訊,請參閱 /clr (Common Language Runtime 編譯)

如需巨集的詳細資訊,請參閱Predefined Macros

範例

// detect_CLR_compilation.cpp
// compile with: /clr
#include <stdio.h>

int main() {
   #if (_MANAGED == 1) || (_M_CEE == 1)
      printf_s("compiling with /clr\n");
   #else
      printf_s("compiling without /clr\n");
   #endif
}

請參閱

參考

使用 C++ Interop (隱含 PInvoke)