Bill Medland
2001-Apr-10 16:31 UTC
DLL at fixed location and memory sharing between executables
Is there a way to get the following to work under WINE? (i.e. to get two executables to share global memory as they do under windows) We have a DLL that is at a specified memory location. At the top of the code a variable is declared as follows: #pragma data_seg( "global_mem" ) #pragma bss_seg( "global_mem" ) unsigned uAttachmentCount = 0; Now.. The main program links to that DLL and as part of the DllMain it increments that count. The main program executes another program. That other program also links to that DLL. Under Windows the DLL is loaded into a single space in memory and the second executable increments the variable from 1 to 2. Under Wine (the way I currently have it set up) the second executable increments it from zero to 1. This indicates to me that the executables are actually running in some sort of separate virtual machines. Is there any way for me to configure Wine so that both processes use the same memory? Bill Medland
Alexandre Julliard
2001-Apr-13 15:42 UTC
DLL at fixed location and memory sharing between executables
Bill Medland <medbi01@accpac.com> writes:> Is there a way to get the following to work under WINE? (i.e. to get two > executables to share global memory as they do under windows) > > We have a DLL that is at a specified memory location. > > At the top of the code a variable is declared as follows: > > #pragma data_seg( "global_mem" ) > #pragma bss_seg( "global_mem" ) > > unsigned uAttachmentCount = 0; > > [...] > > Is there any way for me to configure Wine so that both processes use > the same memory?You cannot do that for whole processes, but if the data section in the dll is marked as shared, Wine will share it among all processes, even though the processes themselves are in separate address spaces. Did you configure the global_mem section as shared in your dll .def file? (I assume you are compiling your dll under Windows; the above #pragma is not supported by Linux compilers). -- Alexandre Julliard julliard@winehq.com
Bill Medland
2001-Apr-16 11:43 UTC
DLL at fixed location and memory sharing between executables
Yes the section was marked as shared in the DEF file.
Alexandre Julliard
2001-Apr-16 12:02 UTC
DLL at fixed location and memory sharing between executables
"Bill Medland" <medbi01@accpac.com> writes:> Yes the section was marked as shared in the DEF file.It turns out that shared section support got broken somehow. I have fixed it, so if you get the latest CVS it should now work as expected. -- Alexandre Julliard julliard@winehq.com