Kompilatorfel C2434

"symbol" : en symbol som deklareras med __declspec(process) kan inte initieras dynamiskt i /clr:pure-läge

Anmärkningar

Alternativen /clr:pure och /clr:safe compiler är inaktuella i Visual Studio 2015 och stöds inte i Visual Studio 2017.

Det går inte att dynamiskt initiera en variabel per process under /clr:pure. Mer information finns i /clr (Common Language Runtime Compilation) och process.

Example

I följande exempel genereras C2434. Åtgärda problemet genom att använda konstanter för att initiera process variabler.

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