Note: When building a program with the IDDE, it calls Digital Mars' rcc resource compiler to compile the program's resources (the Digital Mars linker actually binds the resources to the executable). In contrast, rc both compiles the resources and binds them to the executable.
The resource script file lists every resource in the application and describes some types of resources in detail:
Note: A line in the resource script file cannot exceed 256 characters.
To start rc, use the rc command. What you specify on the command line will depend on whether you are compiling resources, adding compiled resources to an executable file, or both. For more information, see the section "Different Ways to Use the rc Command" later in this chapter.
rc commands have the following form:
rc [options] [resource-file] [executable-file]
The options are command line options. The resource-file is the name of the resource file, and executable-file is the name of the executable with which you want to combine resource-file. These command parameters are described below.
rc options are not case-sensitive. For example, -r and -R are equivalent. You can combine single-letter options if they do not require any additional parameters. For example, the command:
rc -R -E -V sample.rc
is equivalent to the command:
rc -REV sample.rc
The options parameter can include one or more of the rc options described in the section below.
The resource-file parameter specifies the name of the script file that contains the names, types, filenames, and descriptions of the resources you want to add to the executable file. It can also specify the name of a compiled resource file in which case rc adds the compiled resources to the executable file.
The executable-file parameter specifies the name of the executable file to which the resources should be added. If you do not specify an executable file, rc uses the executable file with the same name as the script file.
This section describes the options you can use with rc.
Defines a symbol for the preprocessor that testable with the #ifdef directive.
You can specify conditional branching in a resource script file based on whether or not a term is defined on the rc command line using the -D option. For example, suppose your application has a pop-up menu, the Debug menu, which you want to appear only during debugging. When you compile the application for normal use, the Debug menu is not included. Your resource script file contains the following statements to define the Debug menu:
MainMenu MENU BEGIN ... #ifdef DEBUG POPUP &Debug BEGIN MENUITEM &Memory usage, ID_MEMORY MENUITEM &Walk data heap, ID_WALK_HEAP END #endif END
When compiling resources for a debugging version of the application, you include the Debug menu by using the following command:
rc -R -D DEBUG myapp.rc
To compile resources for a version of the application that does not include the Debug menu, you would use the following command:
rc -R myapp.rc
These switches control how rc names the executable and resource files it creates.
Normally, rc names the compiled resource file after the resource script file and places it in the same directory as the script file. For example, when compiling myapp.rc, you would normally type:
rc would then create a compiled resource file named myapp.res in the same directory as myapp.rc.
This option gives the resulting resource file a name that differs from the corresponding resource script file. For example, to name the resulting resource file newfile.res, type:
rc -R -FO newfile.res myapp.rc
Use this option to place the resource file in a different directory. For example, the following command places the compiled resource file myapp.res in the directory c:\resource:
rc -R -FO c:\source\resource\myapp.res myapp.rc
Normally, rc searches for include files and resource files, such as icon and cursor files, first in the current directory and then in the directories specified by the INCLUDE environment variable. (The PATH environment variable has no effect on the directories rc searches.)
Searches the specified directory before searching the directories specified by the INCLUDE environment variable.
With this option, the compiler searches directories in the following order:
The following example compiles the resource script file myapp.rc and adds the compiled resources to myapp.exe:
rc -I c:\source\stuff -I d:\resources myapp.rc myapp.exe
When compiling the script file, rc searches for include files and resource files first in the current directory, then in c:\source\stuff and d:\resources, and lastly in the directories specified by the INCLUDE environment variable.
Prevents rc from checking the INCLUDE environment variable when searching for include files or resource files.
If you use this option, the compiler searches for files in the current directory and in any directories you specify using the -I option. The following example compiles the resource script file myapp.rc and adds the compiled resources to myapp. exe:
rc -X -I c:\source\stuff myapp.rc myapp.exe
When compiling the script file, rc searches for include files and resource files first in the current directory and then in c:\source\stuff.
These options let you specify how your application uses memory.
Note: The Memory options have no effect on applications written for Windows 3.1 or later.
For a DLL, changes the default location of global memory from below the EMS bank line to above it.
Tells Windows that the application uses expanded memory directly, according to the Lotus-Intel-Microsoft Expanded Memory Specification (EMS), version 2.2.
This switch can also be specified as -LIM32.
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 can also be specified as -MULTINST.
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) will be calling into 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.
Creates an application that runs only with Windows in protected (standard or 386 enhanced) mode. If the user attempts to run the application in real mode, Windows displays a message box telling the user that the application cannot run in real mode.
This option lets you choose whether rc optimizes your resources for preloading.
Disables rc's load-optimization feature. 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.
Without 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 64KB. If the PRELOAD attribute is not assigned to these segments in the module-definition (.def) file when you link your application, the compiler 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 prevent the final executable file from growing unnecessarily large. You can set the alignment using the linker's /alignment option.
This option sets where to place the resources: in a resource file or an executable file.
Creates a resource file from a resource script file.
By default, rc adds the compiled resources to the specified executable file. Sometimes you might want to compile the resources first and then add them to the executable file in separate steps. This can be useful if the contents of a resource file will be stable after initial development. You can save time by compiling resources separately, then adding the compiled resource file to your executable file each time you recompile the executable.
Use the -R option to compile the resources separately, without adding them to the executable file. When you use this option, rc compiles the resource script file and creates a compiled resource file. For example, this command reads the resource script file sample.rc and creates the compiled resource file sample.res:
rc -R sample.rc
The command does not add sample.res to the executable file.
Normally, rc does not display messages that report on its progress as it compiles. You can, however, tell the compiler to display these messages with this option. The following example causes the compiler to report on its progress as it compiles the script file sample.rc, creates the compiled resource file sample.res, and adds the resource file to the executable file sample. exe:
rc -V sample.rc
This option displays on-line help for rc.
Displays a list of the rc command line options.
This section describes the various ways to use the rc command.
To compile resources separately, use the rc command in the following form:
rc -R options script-file
With this form, rc ignores the executable file if you specify one.
To compile a resource script file and add the resulting resource file to the executable file, use the rc command in the following form:
rc options script-file executable-file
To compile a DLL that does not have a resource file, use the rc command in the following form:
rc options dll-file
With this form, the DLL filename must explicitly have an .exe, .drv, or .dll extension.
To 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
AltStyle によって変換されたページ (->オリジナル) / アドレス: モード: デフォルト 音声ブラウザ ルビ付き 配色反転 文字拡大 モバイル