WineBuild/WineLib <-> MFC

jaymz at free.fr jaymz at free.fr
Thu Dec 5 05:23:20 CST 2002


Going further into the MFC dll handling, I raised the following issue:

I have two dynamic libs (mfc.dll.so and myapp.dll.so), both loaded by 
the wrapper (myapp.exe.so).
The problem is that global or static class variables are badly exported 
from mfc.dll.so to myapp.dll.so.

Here's an example:
In mfc.dll.so, let assume that I export a global integer variable named 
myVar.

I add @ extern myVar myVar in mfc.dll.spec.
When I do a GetProcAddress of myVar from the wrapper, the returned 
address is good, but when I link my application, myVar is undefined 
(WineBuild did not include it in myapp.dll.spec.c).

If I add instead in the spec file something like @ stdcall myVar() 
myVar, it's still good when using GetProcAdress, I can now link my 
application, but at runtime, the address of the variable is not the good 
one, so I'm using corrupted data ! Therefore, when the app runs, all 
static data are in fact not or badly initialized and it crashes.

What's the exact syntact to correctly export class static variable from 
a dll ?
Thanks a lot for your attention.




More information about the wine-devel mailing list