From: cgf AT cygnus DOT com (Christopher G. Faylor) Subject: Re: Global data in DLL's how? 26 May 1998 14:20:41 GMT Message-ID: <6kej3p$nks$1@cronkite.cygnus.com> References: <199805240344 DOT UAA17250 AT prefetch-atm DOT san DOT rr DOT com> <19980525140222 DOT 28006 DOT cygnus DOT gnu-win32 AT murlibobo DOT cs DOT mu DOT OZ DOT AU> X-Newsreader: trn 4.0-test63 (15 March 1998) In article <19980525140222 DOT 28006 DOT cygnus DOT gnu-win32 AT murlibobo DOT cs DOT mu DOT OZ DOT AU>, Fergus Henderson wrote: >On 23-May-1998, Steve Biskis wrote: >> I don't know if the Gnu/Cygnus development environment >> supports this but the MS prescribed way to change the >> default behavior of globals so that they may be shared >> by all attached processes is to add a directive like the >> following to your DLL's entry module: >> >> #pragma data_seg( ".GLOBALS" ) >> int nProcesses =0; >> int nThreads =0; >> #pragma data_seg() > >The gcc equivalent of this would be > > int nProcesses __attribute__((section(".GLOBALS")) = 0; > int nThreads __attribute__((section(".GLOBALS")) = 0; > >However, I have no idea whether this works. I don't believe that it does. Currently, the linker becomes confused by sections that are "non-standard". Adding something like the above would probably result in an invalid format for your .dll or .exe. Incidentally, to make this sharable you'd also have to mark the segment as sharable in some way. There is currently no way to do that using cygwin tools. -- cgf AT cygnus DOT com "Everything has a boolean value, if you stand http://www.cygnus.com/ far enough away from it." -- Galena Alyson Canada