Fwd: Re: [putty]Winelib support + patch
fgouget at free.fr
Mon Nov 25 16:39:19 CST 2002
On Mon, 25 Nov 2002, Dimitrie O. Paun wrote:
> This is a very valid question.
> Alexandre, do we support generating regular executables
> for the apps we don't necessarily need the wrapper stuff
> for initialization purposes?
I assume Putty was compile as: 'putty.exe.so'. It's necessary to compile
Winelib applications as .so libraries due to initialization order
issues. I'll let Alexandre explain it in more detail but I believe that
in essence we need the wine loader to initialize things first.
However there is no wrapper involved in the above. if you have a
wrapper, then the load sequence is: wine loads mfcapp.exe.so which is
the wrapper, and then mfcapp.exe.so then loads mfcapp.dll.so which
contains the actual application.
I say 'mfcapp' because it's a typical case where you need the arapper.
The reason for this one is that because of C++ you need to link to the
mfc library in the Unix sense (Winelib does not know how to import
virtual table pointers because they are variables, not functions). But
this causes MFC static initializers to run before the dlls it depends on
have been loaded and initialized.
So we get wine to load mfcapp.exe.so which just links to a bunch of Wine
libraries causing them to be loaded and initialize. Only then, i.e. in
its 'WinMain', does the wrapper do a LoadLibrary of 'mfcapp.dll'. This
causes libmfc.so to be loaded but that's ok since the libraries it
depends on have been initialized by now.
So you see, the putty situation really is not that ugly<g>.
Francois Gouget fgouget at free.fr http://fgouget.free.fr/
Nouvelle version : les anciens bogues ont été remplacés par de nouveaux.
More information about the wine-devel