This is the mail archive of the cygwin@sourceware.cygnus.com mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: Global data in DLL's how?


In article <19980525140222.28006.cygnus.gnu-win32@murlibobo.cs.mu.OZ.AU>,
Fergus Henderson <fjh@cs.mu.OZ.AU> wrote:
>On 23-May-1998, Steve Biskis <mlx@san.rr.com> 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@cygnus.com             "Everything has a boolean value, if you stand
http://www.cygnus.com/      far enough away from it."  -- Galena Alyson Canada
-
For help on using this list (especially unsubscribing), send a message to
"gnu-win32-request@cygnus.com" with one line of text: "help".


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]