mirror of
https://github.com/Mercury-Language/mercury.git
synced 2026-04-15 09:23:44 +00:00
In Unix expansion of wildcard arguments is done by the shell. On Windows,
this is not the case and programs are responsible for expanding wildcard
argument themselves. When using source file mapping, we typically used
wildcards to specify the source files to map. When native Windows Mercury
compilers are used in the Windows command prompt or PowerShell, this does
not work, which is inconvenient to say the least. (In environments like
Cygwin or MSYS2, the shell does do wildcard expansion.)
Microsoft's C runtime has an optional component that programs can
link against which will do wildcard expansion on the argument vector
before main is called. Set up builds with MSVC to link against this
component when building the Mercury compiler.
scripts/parse_ml_options.sh-subr.in:
scripts/ml.in:
Add a new option --use-msvc-setargv-extension, which causes the the
wsetargv.obj file that enables the extension to be passed the linker.
(MSVC seems rather picky about where this is positioned. A a result
we do it within the ml script where have we more control over the matter.)
compiler/Mmakefile:
Pass --use-msvc-setargv-extension to the ml script if we are using MSVC.
Unrelated: Fix the identity of a compiler in a comment.
Unrelated: Add an XXX about something that looks suspicious.
util/mkinit.c:
Add a pointer to scripts/ml.in, saying that if the Windows entry
point (currently wmain) is updated, then the script may need to
be updated.