in reply to [Raku] Asterisk on DOS command line

In Windows 10 and using rakubrew I found the behavior indeed depends of the build environment used.
(rakubrew can download some prebuild versions, all compiled with MS tools)

With a raku built with MS tools the arguments remains unexpanded as expected:

C:\moar-2020.05.1\bin>raku -e "say @*ARGS.join: ' ';" abc * def abc * def C:\moar-2020.05.1\bin>raku -e "say $*VM.config<cc ldlibs>" (cl shell32.lib ws2_32.lib mswsock.lib rpcrt4.lib advapi32.lib psapi. +lib iphlpapi.lib userenv.lib user32.lib)

When built with mingw tools (from Strawberry perl) the resulting raku expands:

C:\moar-2020.05\install\bin>raku -e "say @*ARGS.join: ' ';" abc * def abc libmoar.dll.a moar.dll moar.exe nqp-m.exe nqp.exe perl6-debug-m.ex +e perl6-debug.exe perl6-m.exe perl6.exe raku-debug.exe raku.exe rakud +o-debug-m.exe rakudo-debug.exe rakudo-m.exe rakudo.exe def C:\moar-2020.05\install\bin>raku -e "say $*VM.config<cc ldlibs>" (gcc -lshell32 -lws2_32 -lmswsock -lrpcrt4 -ladvapi32 -lpsapi -liphlp +api -luserenv -luser32)

As the linked libraries are the same, I can only think in some differences in the startup code injected by the build environment.

Replies are listed 'Best First'.
Re^2: [Raku] Asterisk on DOS command line
by jcb (Parson) on Feb 12, 2021 at 02:33 UTC

    You are correct; the C runtime startup code is responsible for preparing the arguments to main on Windows. Native Windows programs do not use main as their entry point.

    Most likely, the mingw startup code expands globs because GNU programs expect the shell invoking them to have already done that. If the MinGW C startup code did not do this, most GNU programs would not support filename globs on Windows.

    There should be an option to specify whether or not to expand globs in argv when linking a MinGW program, since most programs need that, but a few do not. If there is no such option currently, that is arguably a bug in MinGW.

      For MinGW64's gcc, the included with Strawberry perl, I found that adding to the linker one of the included crt files CRT_glob.o or CRT_noglob.o does the trick. Choice your poison.