Editing command line options

The Project Options dialog displays a list of commands that correspond to the Make Menu items. These command lines are built by RadASM from the variables that you enter in Project Options or those that are specified as default for the project type you chose when you created the project.

The link command will be used to demonstrate how to modify these entries.

Link command line from MASM Win32 App release:

3=5,O,$B\LINK.EXE /FILEALIGN:512 /SUBSYSTEM:WINDOWS /RELEASE /VERSION:4.0 /LIBPATH:"$L",3,4

Let's break down the entry, the commands in Project Options are identical.

3= - This specifies that this command line is the link command
5 - In the project ini (rap) file there is a section called , this number corresponds to the file number for the exe file. RadASM will delete this file before executing the command and will generate an error if it is not present once the command has finished.
,O - This specifies that all messages will be directed to RadASM's Output window. The other option "C" will direct output to the Console. Adding a T to this parameter (,OT) will cause the command line to be output to the RadASM output window.
,$B - This variable corresponds to the BIN folder specified in the $_ variables in assembler.ini
\Link.exe - this is the actual name of the link program to be used
/FILEALIGN:512 /SUBSYSTEM:WINDOWS /RELEASE /VERSION:4.0 - Command switches
/LIBPATH:"$L" - in this case the $L will be replaced by the value of $L in the paths section of your assemblers ini file. The quotes will cause it to be encased in quotes.
,3,4 - these numbers correspond to the file numbers in the project ini (rap) file and will be replaced by those file names. In this case project.obj and project.res

After the link command the presence of a comma will signal two things to the RadASM parser, first that the next number represents a file in the project ini (rap) file, and second that it should be encased in quotes. The quotes will be preceded by a space. The quotes will encase everything up to the end of the line or until it reaches another comma. for example if you had :

1,3 /hello /there,4

It would be parsed as follows :

1 "project.obj /hello /there" "project.res"

The preceding rule creates two problems when generating command lines, first how to include a dynamic filename without the use of quotes and second how to include a comma in a command line.

As can be seen in the example above if you use the 1 without a comma before it it will be treated as a literal number however if you wish to use the represented file in the rap file you can use the $ to indicate that the number is to be treated as a variable :

$1,3 /hello /there,4

It would be parsed as follows :

project.rc "project.obj /hello /there" "project.res"

Notice that file name for 1 (project.rc) is not encased in quotes. If you need it encased in quotes you can use "$1" and the filename will be included with quotes. Using this method can allow switches to be used after the file name has been included. In the first example the switches were encased in the quotes with the file name and would generate an error, if you replaced the ,3 with "$3" everything would be correct.

The other problem presented by the parser rules is the inclusion of a comma. As has been demonstrated a comma is used by the parser to signal that the text should be quoted, in order to use a comma in the command line the parser allows for the pipe | symbol. When the parser encounters a | it will replace it with a comma. There is no replacement available for the pipe symbol. For example if you needed the following command line.

Something.exe /Switch "project.rc",3

First the inclusion of a comma before the 1 would quote the whole line so the ,1 would be replaced with the alternative "$1", second, the comma after the quoted file name would quote 3 and convert it to a file name if it was included directly so it is replaced with the pipe symbol. Without the comma or $ the 3 will be treated as a literal numeric value. So the command line would look like this :

Something.exe /Switch "$1"|3

NOTE : In the case of the compile RC command line the inclusion of a .exe on the name of the executable will remove any generated quotes from the command line.