Compiler Error C2441
Collapse the table of content
Expand the table of content
Important This document may not represent best practices for current development, links to downloads and other resources may no longer be valid. Current recommended version can be found here. ArchiveDisclaimer

Compiler Error C2441

'variable' : a symbol declared with __declspec(process) must be const in /clr:pure mode

By default, variables are per application domain under /clr:pure. A variable marked __declspec(process) under /clr:pure is prone to errors if modified in one application domain and read in another.

Therefore, the compiler enforces per process variables be const under /clr:pure, making them read only in all application domains.

For more information, see process and /clr (Common Language Runtime Compilation).

The following sample generates C2441.

// C2441.cpp
// compile with: /clr:pure /c
__declspec(process) int i;   // C2441
__declspec(process) const int j = 0;   // OK
© 2015 Microsoft