Wine preloader redux

Alexandre Julliard julliard at
Tue Mar 4 07:30:48 CST 2008

"Dan Kegel" <dank at> writes:

> Alexandre Julliard <julliard at> wrote:
>>  I'm not sure you can do the ELF magic with a static library, but even if
>>  you could there's a lot more to the initial setup than the preloader;
>>  that's why winelib apps are shared libraries, so that we can do all the
>>  work that needs to be done before they get loaded.
> What's one other thing that couldn't reasonably happen
> at global constructor time (i.e., just before main())?

Global constructor time is too late, by this time dependent libraries
will have been loaded and initialized, which will crash and burn if some
of them are Windows dlls. Also you need the environment and command line
setup before the global constructors are run. You also need to setup the
process stack, which you can't do inside a constructor that you have to
return from.

Alexandre Julliard
julliard at

More information about the wine-devel mailing list