On Thu, Aug 27, 2020 at 8:51 AM Vincent Torri <vincent.to...@gmail.com> wrote:
>
> On Thu, Aug 27, 2020 at 8:45 AM Ruben Van Boxem
> <vanboxem.ru...@gmail.com> wrote:
> >
> > Op do 27 aug. 2020 om 07:18 schreef Vincent Torri <vincent.to...@gmail.com>:
> >
> > > On Thu, Aug 27, 2020 at 3:24 AM Liu Hao <lh_mo...@126.com> wrote:
> > > >
> > > > 在 2020/8/27 上午2:06, Vincent Torri 写道:
> > > > >
> > > > > i've checked in cmd too, same result
> > > > >
> > > > > But there is anyway something strange to me :
> > > > >
> > > > > myprog_gcc.exe and myprog_vs are *both* run in MSYS2, and the result
> > > > > is different. So I don't think it's related to path translation. It
> > > > > would suggest something related to how gcc builds the binary
> > > > >
> > > >
> > > >
> > > > In 'mingw-w64-crt/crt/crtexe.c' , `argv` is initialized by the function
> > > `__getmainargs()` which is imported from MSVCRT. VC
> > > > uses new versions of runtime libraries so it'd be MSVCR100, MSVCR120,
> > > etc. There might be some differences in the
> > > > aforementioned function.
> > >
> > > that makes sense. Is it possible to tell gcc to use msvcr*.dll instead
> > > of msvcrt.dll ?
> > >
> >
> > Asking where the difference comes from is a useful question.
> > Relying on these kinds of details to make Unicode work is not IMHO.
> >
> > If you want correct handling of unicode path names, call the appropriate
> > functions.
> > Either compile the GCC code with -municode and use _wmain, or call
> > CommandLineToArgvW with GetCommandLineW and then a _wfopen.
> > Windows is an obtuse platform, and its shells do not support the Unix-wide
> > UTF-8 assumption.
>
> I will try this, thank you

test file :

------------------------------
#include <stdio.h>

#include <windows.h>

int wmain( int argc, wchar_t *argv[ ], wchar_t *envp[ ] )
{
  if (argc < 2)
    {
      wprintf(L"%s\n", argv[0]);
      return 1;
    }

  return 0;
}
---------------------------

but :
$ gcc -g -Wall -o fopenw fopenw.c -municode
C:/Documents/msys2/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/10.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe:
C:/Documents/msys2/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/10.2.0/../../../../x86_64-w64-mingw32/lib/../lib/libmingw32.a(lib64_libmingw32_a-crt0_w.o):
in function `wmain':
D:/mingwbuild/mingw-w64-crt-git/src/mingw-w64/mingw-w64-crt/crt/crt0_w.c:23:
undefined reference to `wWinMain'
collect2.exe: error: ld returned 1 exit status

no idea what is missing, here...

Vincent Torri


_______________________________________________
Mingw-w64-public mailing list
Mingw-w64-public@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mingw-w64-public

Reply via email to