Compiler Error C3389

 

The new home for Visual Studio documentation is Visual Studio 2017 Documentation on docs.microsoft.com.

The latest version of this topic can be found at Compiler Error C3389.

__declspec(keyword) cannot be used with /clr:pure or /clr:safe

A __declspec modifier used implies a per process state. /clr:pure implies a per appdomain state. So, declaring a variable with the keyword__declspec modifier and compiling with /clr:pure is not allowed.

The following sample generates C3389:

// C3389.cpp  
// compile with: /clr:pure /c  
__declspec(dllexport) int g2 = 0;   // C3389  

Show: