Next: , Previous: , Up: Microsoft Windows Topics   [Contents][Index]


7.4.5 Disabling Command Line Argument Expansion

By default, an executable compiled for the Windows platform will do the following postprocessing on the arguments passed on the command line:

Note that if the program is launched from a shell such as Cygwin Bash then quote removal might be performed by the shell.

In some contexts it might be useful to disable this feature (for example if the program performs its own argument expansion). In order to do this, a C symbol needs to be defined and set to 0. You can do this by adding the following code fragment in one of your Ada units:

Do_Argv_Expansion : Integer := 0;
pragma Export (C, Do_Argv_Expansion, "__gnat_do_argv_expansion");

The results of previous examples will be respectively:

Ada.Command_Line.Argument (1) -> "*.txt"

and:

Ada.Command_Line.Argument (1) -> "'*.txt'"