Resource member initialisation overview

The resource initialiser has different forms depending on whether a single, simple, member is being initialised, or whether a struct or an array is being initialised:

<resource-initialiser>
resource-initialiser ::=
	<member-name> [ (<length-limit>) ] = <initialiser><initialiser>
initialiser ::=
	<simple-initialiser> | <struct-initialiser> | <array-initialiser>

Resource members may be initialised by default (in the struct definition) or explicitly initialised (in the resource definition).

In general,

  • If a member is initialised in a RESOURCE statement, then that is its value.

  • If a member is initialised in a STRUCT statement, then that is its value for all resources which do not explicitly initialise it.

  • If a member is neither initialised in a RESOURCE statement nor a STRUCT statement, then: BYTE, WORD and DOUBLE members contain zero; TEXT, LTEXT and BUF members contain an empty string.

  • It is an error for LINK and LLINK members to have no explicit value, so they must be initialised, either by default (in the STRUCT statement) or explicitly (in the RESOURCE statement).

  • SRLINK members may not be initialised (either in the STRUCT statement or a RESOURCE statement) since they are automatically assigned the resource id of the resource in which they appear.

  • Members which are themselves STRUCT s may not be default initialised. They can only be initialised in the RESOURCE definition. If they are not explicitly initialised, they will take up zero bytes in the resource file. For example, given the following STRUCT definition:

    STRUCT TEST2 
     {
     WORD    value;
     STRUCT  tester;
     }

    The following RESOURCE statement only generates the two bytes 0xFF 0x00.

    RESOURCE TEST2 item
     {
     value=255;
     }