2.3.1 Command-Line Syntax

To start RC, use the rc command. What you need to specify on the command line depends on whether you are compiling resources, adding compiled resources to an executable file, or both.

The following line shows rc command-line syntax:

rc [options] definition-file [executable-file]

Following are several ways you can use the rc command:

To compile resources separately, use the rc command in the following form:

rc /r [options] definition-file

When you use this form, RC ignores any executable file you specify.

To compile an .RC file and add the resulting .RES file to the executable file, use the rc command in the following form:

rc [options] definition-file [executable-file]

To compile an application or DLL that does not have a .RES file, use the rc command in the following form:

rc [options] dll-or-executable-file

When you use this form, the filename must explicitly have an .EXE, .DRV, or .DLL extension.

To simply add a compiled resource (.RES) file to an executable file, use the rc command in the following form:

rc [options] res-file.res [executable-file]

2.3.1.1 Specifying Options

The rc command's options parameter can include one or more of the following options:

/30

Marks the executable file so it will run with Windows version 3.0 or Windows version 3.1. By default, RC marks the executable file to run only with Windows 3.1.

/31

Marks the executable file so it will run only with Windows 3.1. This is the default condition.

/?

Displays a list of rc command-line options.

/d

Defines a symbol for the preprocessor that you can test with the #ifdef directive.

/e

Changes the default location of global memory for a DLL from below the Expanded Memory Specification (EMS) bank line to above the EMS bank line. This option has no effect with Windows 3.1.

/fe newname

Uses newname for the name of the .EXE file.

/fo newname

Uses newname for the name of the .RES file.

/h

Displays a list of rc command-line options.

/i

Searches the specified directory before searching the directories specified by the INCLUDE environment variable.

/k

Disables the load-optimization feature of RC. If this option is not specified, the compiler arranges segments and resources in the executable file so that all preloaded information is contiguous.

This feature allows Windows to load the application much more quickly. If you do not specify the /k option, all data segments, nondiscardable code segments, and the entry-point code segment will be preloaded, unless any segment and its relocation information exceed 64K. If the PRELOAD attribute is not assigned to these segments in the module-definition (.DEF) file when you link your application, RC will add the PRELOAD attribute and display a warning. Resources and segments will have the same segment alignment. This alignment should be as small as possible to limit the size of the final executable file. You can set the alignment by using the link command with the /a option.

/l[im32]

Specifies to Windows that the application uses expanded memory directly, according to the Lotus/Intel/Microsoft Expanded Memory Specification (LIM EMS), version 3.2. This option has no effect with Windows 3.1.

/m[ultinst]

Assigns each instance of the application task to a distinct EMS bank when Windows is running with the EMS 4.0 memory configuration. (By default, all instances of a task share the same EMS bank.) This option has no effect with Windows 3.1.

/p

Creates a private DLL that is called by only one application. This allows Windows to use memory more efficiently, because only one application (or multiple instances of the same application) calls the DLL. For example, in the large-frame EMS memory model, the DLL is loaded above the EMS bank line, freeing memory below the bank line. This option has no effect with Windows 3.1.

/r

Creates an .RES file from an .RC file. Use this option when you do not want to add the compiled .RES file to the .EXE file.

/t

Creates an application that runs with Windows only in protected (standard or 386 enhanced) mode. If the user attempts to run the application in real mode, Windows will display a message that the application cannot run in real mode. This option has no effect with Windows 3.1.

/v

Displays messages that report on the progress of the compiler.

/x

Prevents RC from checking the INCLUDE environment variable when searching for header files or resource files.

/z

Prevents RC from checking for RCINCLUDE statements. When you have not used RCINCLUDE statements, using this option can greatly improve the speed of RC.

Options are not case-sensitive, and a hyphen (-) can be used in place of a slash mark (/). You can combine single-letter options if they do not require any additional parameters.

2.3.1.2 Specifying the Resource-Definition File

The rc command's definition-file parameter specifies the name of the resource-definition file that contains the names, types, filenames, and descriptions of the resources to be added to the .EXE file. It can also specify the name of a compiled .RES file, in which case RC adds the compiled resources to the executable file.

2.3.1.3 Specifying the Executable File

The rc command's executable-file parameter specifies the name of the executable file that the compiled resources should be added to. If you do not specify an executable file, RC uses the executable file with the same name as the resource-definition file (excluding the filename extension).

2.3.1.4 Renaming the Executable File

The rc command's /fe option makes it possible for you to specify the name of the final executable file. The following example combines MYEXE.EXE with MYRES.RES to produce the final executable file FINAL.EXE:

rc /fe final.exe myres.res myexe.exe