This is the mail archive of the
cygwin@sourceware.cygnus.com
mailing list for the Cygwin project.
Re: Global data in DLL's how?
- To: mlx at san dot rr dot com
- Subject: Re: Global data in DLL's how?
- From: Fergus Henderson <fjh at cs dot mu dot OZ dot AU>
- Date: Mon, 25 May 1998 14:02:22 +1000
- Cc: Craig Setera <setera at us dot ibm dot com>, gnu-win32 at cygnus dot com
- References: <199805240344.UAA17250@prefetch-atm.san.rr.com>
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 do know that the technique of using
#define nProcesses (*__imp_nProcesses)
works. (This technique is automated if you use my Makefile.DLLs,
see <http://www.cs.mu.oz.au/~fjh/gnu-win32/how-to-build-dlls.html>.)
--
Fergus Henderson <fjh@cs.mu.oz.au> | "I have always known that the pursuit
WWW: <http://www.cs.mu.oz.au/~fjh> | of excellence is a lethal habit"
PGP: finger fjh@128.250.37.3 | -- the last words of T. S. Garp.
-
For help on using this list (especially unsubscribing), send a message to
"gnu-win32-request@cygnus.com" with one line of text: "help".