I did some Google around and found some ideas about how to fix it. I also found some solutions that worked in the past but not working with the new versions so I did a quick and dirty fix to my code using ANSI startup for MinGW in all environments. Here is how the main(...) function looks like:
/* for porting from other Windows compilers */
#if 0 /* no wide startup module */
#define _tmain wmain
#define _tWinMain wWinMain
#define _tenviron _wenviron
#define __targv __wargv
#endif
This is quite strange. Why there is no support for Unicode startup code in MinGW? I don't believe this is too hard to achieve! Here is a patch done in 2003. Looks like it never made it to the official build: http://osdir.com/ml/gnu.mingw.patches/2003-05/msg00001.html .
#ifdef __GNUC__
int main(int argc, char **a_argv)
#else // !__GNUC__
int _tmain(int argc, TCHAR **argv)
#endif // __GNUC__
{
// some variables defined here
// ...
#ifdef __GNUC__
TCHAR **argv;
#ifdef UNICODE
// MinGW doesn't support wmain() directly (shame on its CRT!)
int a_argc;
argv = CommandLineToArgvW(GetCommandLineW(), &a_argc);
#else // !UNICODE
argv = a_argv;
#endif // UNICODE
#endif // __GNUC__
You can get the program and play with it if you like. There is more info about it inside the readme.txt file.
No comments:
Post a Comment