WinMainSupport

WinMainSupport

This project aims at making winegcc link automatically to main() or WinMain() as appropriate (just like MinGW does on Windows).

The easiest way to support this would be with some sort of crt0 static library that provides main() if it's missing; you have a main() that basically calls WinMain(), compiled inside a .a library. At link time if you have a main() already the linker doesn't use the .a, otherwise it uses it. crt0 is the default C startup code, currently we generate it inside the .spec file directly but it would be cleaner to have a separate it as a crt0.o file; it's also needed if we want full msvcrt compatibility. We need at least a crt0.o to call main(), and another .o providing the default main().

There may also be a need to handle msvcrt specially (i.e. link another .a in msvcrt mode), so that we call exit() when linked to msvcrt instead of calling ExitProcess() as we normally do. In other words, we'll need to create a winecrt0-glibc.a and a winecrt0-msvcrt.a, and in winegcc we just list the appropriate one as the last element on the linker command line.

WinMainSupport (last edited 2008-05-03 00:41:15 by nathan.n)