Winelib and static-build

Alan Nisota alannisota at
Sat Oct 25 10:10:58 CDT 2008

Dan Kegel wrote:
> For starters, have you tried CreateFileMapping in wine, and
> mmap on the same file in the native bit?
> Sadly, linux does not use tmpfs by default, so the backing
> store writes would probably hurt performance.
> But it would be interesting to hear whether this worked at all.
Very cool.  Here is what I did:
In linux (host):
use shm_open and ftruncate to create a shared-memory region (this will 
be at /dev/shm/<name> in linux)
use mmap to map that into memory
create a socket to use as a semaphore

In the windows executable:
use CreateFile to open Z:\dev\shm\<name>
use CreateFileMapping and MapViewOfFile to map that into memory
open the above socket

I can now pass info back and forth between wine and linux via shared 
memory, using a blocking socket to indicate data valid.  I have only 
done it with a test application so far, and haven't worked out the 
details of timeouts and error handling, but this looks very promising.

I've included the test app I'm using.  It can be compiled natively and 
x-compiled using mingw32.  Instructions for use are at the top.

The next question is whether this can be made more portable so it could 
be used on Mac as well (I've yet to be able to make my loader work on 
Mac, and this theoretically could if I could figure out how to use 
something like tmpfs there).  I am not knowledgable about whether 
BSD/OSX has anything equivalent to tmpfs.

Thanks for all your help.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: testsem3w.c
Type: text/x-csrc
Size: 9633 bytes
Desc: not available
Url : 

More information about the wine-devel mailing list