Compiler Error C2434

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

Remarks

The /clr:pure and /clr:safe compiler options are deprecated in Visual Studio 2015 and unsupported in Visual Studio 2017.

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.

Example

The following sample generates C2434. To fix this issue, use constants to initialize process variables.

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