Compiler Error C2434

 

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 C2434.

symbol' : a symbol declared with __declspec(process) cannot be dynamically initialized in /clr:pure mode

It is not possible to dynamically initialize a per-process variable under /clr:pure. For more information, see /clr (Common Language Runtime Compilation) and process.

The following sample generates C2434.

// C2434.cpp  
// compile with: /clr:pure /c  
int f() { return 0; }  
__declspec(process) int i = f();   // C2434  
__declspec(process) int i2 = 0;   // OK  

Show: