From: mlx AT san DOT rr DOT com (Steve Biskis) Subject: Re: Global data in DLL's how? 24 May 1998 08:27:19 -0700 Message-ID: <199805240344.UAA17250.cygnus.gnu-win32@prefetch-atm.san.rr.com> Reply-To: Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit To: "Craig Setera" Cc: Global variables declared in DLLs exist within the data segment by default. Each process attached to a DLL gets its own copy of the data segment, hence, its own private set of those globals. 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() BOOL WINAPI DLLMain( etc ..... Where nProcesses & nThreads are shared by all ... Since you need it, test and let the rest of us know. da bisk ---------- > From: Craig Setera > To: gnu-win32 AT cygnus DOT com > Subject: Global data in DLL's how? > Date: Friday, May 22, 1998 7:13 AM > > Let's see if I can explain what I think is happening in hopes that someone > can offer a decent solution. > > I'm (still) trying to build DLL's for the GIMP. There are 3 libraries that make > up GTK (the Gimp Toolkit). GLib, GDK and GTK. In GDK, there is a file > that declares an number of global variables. If I build each of these into > separate DLL's, I find that the global variables don't seem to be shared > between GDK and GTK. It appears that each DLL is getting its own copy > of the variables rather than sharing a single copy. > > So, other than providing functions (this would be a cleaner way to do it > in the first place) to retrieve the information from GDK is there a way to > make sure that each of the DLL's has access to the same copy of the > global data? > > Thanks, > Craig > > > Craig Setera > AS/400 Enterprise Java Development > IBM Rochester > setera AT us DOT ibm DOT com > (507) 253-3387 - Tie: 553-3387 > - > For help on using this list (especially unsubscribing), send a message to > "gnu-win32-request AT cygnus DOT com" with one line of text: "help". - For help on using this list (especially unsubscribing), send a message to "gnu-win32-request AT cygnus DOT com" with one line of text: "help".