Re: Possible OS incompatibility with __attribute__ 'shared'

<[email protected]> Sun, 21 Dec 2025 22:47:03 -0000
Newsgroups gmane.comp.gcc.help
Message-ID <[email protected]>
Basile Starynkevitch <[email protected]> wrote:
(21/12/2025 21:46)

>On Sun, 2025-12-21 at 21:32 +0000, [email protected] wrote:
>> Hello. On the web page at https://gcc.gnu.org/onlinedocs/gcc-3.3.3/gcc/Variable-Attributes.html
>> 
>> I found this:
>> int foo __attribute__((section ("shared"), shared)) = 0;
>> 
>> I got it to work (using MinGW GCC) in W98, but the same method did not work in Windows 7, even when restricted to 32-bit process interactions.
>
>
>Current GCC is 15
>
>(the 3.3 one was from 2005)
>
>Regards
>
>-- 
>

Thanks, but that does not answer the question. The compiled code runs on BOTH systems. The only difference is that the method described does not work on Windows 7, whether the resulting executables are recompiled there or not. If it had never worked at all, I'd consider the choice of compiler version as relevant.

The question is not about the versions of GCC. It's about the compatibility for the method as described, given that it works in one Windows OS but not the other. If this puts it beyond the scope of advice on GCC, how about some other simple way to share a single variable between processes using a hook DLL. I mention that because I'm trying to avopid making this an 'XY' problem (a phrase I see a lot on StackOverflow...)

Crow