[m-rev.] for review: support wildcard argument expansion with MSVC
Zoltan Somogyi
zoltan.somogyi at runbox.com
Tue Jan 6 03:33:32 AEDT 2026
On Tue, 6 Jan 2026 03:03:19 +1100, Julien Fischer <jfischer at opturion.com> wrote:
> I added it, because the following does not currently work at the
> Windows command prompt:
>
> mercury -f *.m
>
> (Offhand, I can't think of anywhere else that users of mmc would need wildcard
> expansion.)
mmc --make-int *.m? No, this does not invoke ml, but then, I don't think
mercury -f *.m does either.
> > It does not help even us, Mercury developers, when working in e.g. the browser
>
> There are no executables in the browser directory.
But e.g. mercury -f *.m is useful even in that case.
> The ideal solution would be to provide wildcard expansion as part
> of Mercury's standard library and then programs can selectively process
> the argument vector at startup based on whether the underlying platform
> does wildcard expansion or not. This would work for all backends and
> not rely on various compiler-specific runtime extensions.
>
> Short of that, it's certainly possible to teach the compiler about all this.
> (In fact, it's probably simpler than supporting it in mmake.)
Agreed on both counts.
> > Second, it would be much better if we simply recorded the current platform
> > (including in this case that MSVC was specified as the C compiler) in the ml script
> > at configure time,
>
> We record the C compiler type in the ml script at configure time.
>
> > and let it take care of all its implications, this new one
> > being just one of them.
>
> Because that would affect any use of the ml script, not just building the
> compiler. What if a user does *not* want this runtime extension enabled
> with their program?
We could
- extend the configure script with a flag that sets the default for this to
either on or off.
- embed this default in ml at configure time, and
- let an environment variable override the default.
> > Is there some reason why this wouldn't work?
>
> I think it would work, however I think you still need the ability to control
> whether it is enabled or not.
The above would do that. It would do that for *all* uses of ml, not
just when ml is invoked by mmc.
> > Please document the meaning of this variable.
>
> # MSVC_SETARGV is set to the name of the object file that contains the
> # Microsoft C runtime extension that implements wildcard argument expansion.
> # There are several versions of this object file, the one we choose below must
> # match the program entry point set in value of the variable main_func in
> # ../util/mkinit.c
That's fine, but I would explicitly specify that "" means the absence of such
an object file.
Zoltan.
More information about the reviews
mailing list