I'm porting a Windows C code written for MSVC to be compatible with gcc and clang. I have this snippet of code to declare a variable in a shared segment:
#pragma comment(linker, "/SECTION:.shr,RWS")
#pragma data_seg(".shr")
volatile int g_global = 0;
#pragma data_seg()
I know that the gcc equivalent in Windows is:
volatile int g_global __attribute__((section("shr"), shared)) = 0;
In response to a comment of course I already tried the same attribute with clang but the "shared" key is ignored. What is the working equivalent for the clang compiler in Windows?