[Wine] winelib shared memory problem

AleXoundOS wineforum-user at winehq.org
Sat Feb 4 03:33:06 CST 2012


Hi

I have two programs:
The first is a windows binary compiled in Visual C++ which acts like a Server.
The second program is a Client, which I compile from sources. Both are written in C++.
Server and client communicate using two IPC mechanisms: named pipe and shared memory. shared memory consists of a structure, e.g.:
Code:
struct GameData



Using mingw compiler Client compiles well. Then I launch Server and Client using wine and they connect using both IPC mechanisms properly.

Compiling using winelib also works. But when winelib compiled Client tries to connect with the Server and read shared memory, it fails to read anything properly from the shared memory. I found that it is only able to read one element of the structure properly which appears to be the first element in the shared memory. named pipe connection works without any problems.

After some googling I found that using different compilers may lead to differences in ABI (Application Binary Interface). So I apologized that different compilers can store information using structures differently.
If it is the reason of the problem, then why mingw compiled program matches the Visual C++ ABI and winelib not?
I also tried different -fabi-version=n options for wineg++. But the issue remained. (May be I needed to use this option in conjunction with some other options to get effect?)

Is there a way to solve the problem? Or is there a way to write the structures code in the Server in a way that can be understandable by other compilers? I can ask the author of the Server to rewrite some code, but if it will not require big changes in the code. Compiling the Server using winelib seems to be too complex task, it uses lots of things that are not friendly to gcc.

May be it is not related to ABI?

My aim is to compile Client using winelib, so being able to use linux calls from Client program.

My specs:
wine-1.4-rc2
gcc 4.6.2
mingw32-gcc 4.6.2
Arch Linux x86_64
I'm using glibc library for winelib.







More information about the wine-users mailing list