I've updated my patch because I noticed that I was passing ANSI
versions of _argv and environ to wmain, which kind of defeats the
purpose of the Unicode implementation.
FWIW, it seems to be working for me, in that I can pass Unicode
arguments to my application.
> After making the attached changes, runtime compiles clean. However,
> when I attempt to compile something that has wWinMain defined, I get:
> g++ -Wall -mwindows -mno-cygwin -Wl,--entry=3D_wWinMainCRTStartup -s -o
> "../bin/emergeCore.exe" MessageControl.o LaunchEditor.o Core.o main.o
> Shell.o ShellChanger.o emergeCore.o -L../lib -lshell32 -lemergeLib
> -lshlwapi -lole32 -lcomctl32
> /mingw/lib/libmingw32.a(main.o):main.c:(.text+0x106): undefined
> reference to `WinMain@...'
> collect2: ld returned 1 exit status
> mingw32-make.exe: *** [emergeCore.exe] Error 1
I'd still like to figure out a way around this one. This is due to
the fact that main.c has an extern definition for WinMain, so if one
doesn't exist it complains. On the flip side, if you compile an ANSI
app, it complains about wWinMain, as wWinMain is defined in wmain.c as
The only way around this I could find was to define a WinMain (which
just returns 0) as well as wWinMain. This is obviously not an ideal
situation, so I'm open to suggestions.