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.
jaymz@free.fr wrote: [...]
What's the exact syntact to correctly export class static variable from a dll ?
Exporting a variable is not the problem, what you did is fine. It will work if you try to access this variable from a native Windows dll. The problem is that winebuild does not know how to *import* a variable from another builtin library. For more details see this thread: http://www.winehq.com/hypermail/wine-devel/2002/12/0005.html
That means you have to link with the MFC library in the Unix sense to get these variable references resolved correctly.