NGWS SDK Documentation  

This is preliminary documentation and subject to change.
To comment on this topic, please send us email at ngwssdk@microsoft.com. Thanks!

Compiler Error C2496

'identifier' : 'selectany' can only be applied to data items with external linkage

The selectany attribute can be applied only to externally visible and global data items.

Example

// OK
__declspec(selectany) int x1 = 1;

// error - x2 is not externally visible
const __declspec(selectany) int x2 = 2;

// OK
extern const __declspec(selectany) int x3 = 3;

// OK
__declspec(selectany) int x4;

// OK .. dynamic initialization of x5
int f();
__declspec(selectany) int x5 = f();

// error - x6 is not externally visible
static __declspec(selectany) int x6 = 6;

extern const int x7;
// OK - redeclaration of x7 that is extern
const __declspec(selectany) int x7 = 7;