Subject: Re: Global data in DLL's how?
From: [email-masked] (Christopher G. Faylor)

26 May 1998 14:20:41 GMT
Message-ID: <[email-masked]>
References: <[email-masked]> <[email-masked]>
X-Newsreader: trn 4.0-test63 (15 March 1998)

In article <[email-masked]>,
Fergus Henderson <[email-masked]> wrote:
>On 23-May-1998, Steve Biskis <[email-masked]> 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.
-- 
[email-masked]             "Everything has a boolean value, if you stand
http://www.cygnus.com/      far enough away from it."  -- Galena Alyson Canada