UIQ Technology
 Developer Library

UIQ 3 SDK

UIQ developer portal

FEEDBACK 

[Index] [Spacer] [Previous] [Next]



How to Build a Resource File

Resource building is performed by the epocrc tool using a three-stage process:

Pre-processing

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.

Merging localized strings

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.

Compilation to binary format

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:

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.

Terms and conditions of use of the material