Re: Possible OS incompatibility with __attribute__ 'shared'

<[email protected]> Mon, 22 Dec 2025 13:12:51 -0000
Newsgroups gmane.comp.gcc.help
Message-ID <[email protected]>
Thanks to Stephan Ring, Jonathan Wakely, and Liu Hao. I'm not sure of ideal posting methods, but one reply seems efficient..

In answer to how MS do it, a #pragma data_seg... statement, but I never got my DLL code transcribed for MSVC before finding other easier ways to tackle this. :) I will look at linker options carefully, that notion came up during some Googling last night too.

Further testing shows that it DOES occasionally work in Windows 7 (Thanks Liu, knowing it works in W11 is especially helpful. Also, I will be testing on WXP but I think once I manage on W98 and W7P, it might work on all Win32 as I hope for it to do).

It also (rarely) fails on W98 so I'm now sure it's a problem with my code, something I missed, because once a program is loaded and using a copy of the DLL I imagine it will stay with it, so intermittency is revealing something else... I may have found my first true need for a mutex.

Thanks for the suggestions to get better sharing of memory, the named memory method might be ideal. Other methods always looked like overkill for one 32-bit value but I'll try them until something is solid.

Crow.