Dela via


Så här identifierar du /clr-kompilering

Använd makrot _MANAGED eller _M_CEE för att se om en modul kompileras med /clr. Mer information finns i /clr (Common Language Runtime Compilation).

Mer information om makron finns i Fördefinierade makron.

Exempel

// 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
}

Se även

Använda C++ Interop (implicit PInvoke)