How to: Detect /clr Compilation
Use the _MANAGED
or _M_CEE
macro to see if a module is compiled with /clr. For more information, see /clr (Common Language Runtime Compilation).
For more information about macros, see Predefined Macros.
Example
// 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
}
See also
Feedback
https://aka.ms/ContentUserFeedback.
Coming soon: Throughout 2024 we will be phasing out GitHub Issues as the feedback mechanism for content and replacing it with a new feedback system. For more information see:Submit and view feedback for