|
|
|||
Resource building is performed by the epocrc tool using a three-stage process:
Pre-processing,
Localized string merging,
Compilation to binary format.
Resource files can use the familiar pre-processor directives. In
particular: #include is used to include header files,
#define is used to define macros such as numeric constants and
#if and related directives can be used to perform conditional
compilation. Pre-processor arguments for include file paths and macro
definitions can be passed to the pre-processor through epocrc.
The source file is pre-processed, using the cpp pre-processor, and an output file produced with the extension .rpp.
Strings that should be localized should not be defined in the resource file itself, but in separate files with an .rls extension. When the .rpp files are processed by epocrc, the localizable strings are included.
A flag can also be specified to cause epocrc to copy the .rpp files to a epoc32\localisation\ directory, from where they can form input into a localization kit.
The final stage is to convert the intermediary .rpp files into the final compiled format. This is done by the rcomp tool. The resource compiler also produces a header file that contains a symbolic identifier for each resource.
The names of the output files are specified as parameters to epocrc. Note though that:
Resource files as built by the project build tools, abld, have the default extension .rsc. The additional naming conventions used when you need to supply multiple resource files, each for a different locale, are discussed in How to localise resources,
By convention, the header file has the extension .rsg.
The identifiers in the header file provide symbolic names for index positions in the resource file so that your source code can be independent of the number and order of resources within the file.
For a named resource such as
RESOURCE TBUF r_eik_bafl_error_offset { buf="Wrong format resource file"; }
the generated header file will have a #define such
as
#define R_EIK_BAFL_ERROR_OFFSET 0xf3b045
where the number is a resource ID which encodes the resource index
and is suitable for passing to the C++ function
RResourceFile::AllocReadLC().
In the course of project development, changes to the resource file
may not always result in changes to the set of #define statements
generated. If there are no changes, the .rsg file is not rebuilt,
thereby avoiding unnecessary re-compilation and linking.