Separate Resource Files

Technote TB 25October 1985

Revised by: March 1988
Written by: Bryan Stearns October 1985

During application development, you use a resource compiler (RMaker or Rez) to convert a resource definition file into an executable application. You rarely change anything but your CODE resources during development, and the resource compiler spends a lot of time compiling other resources which have not changed since they were originally created.

To save time, some developers have adopted the technique of storing all of these "static" resources in a separate resource file. This file should be placed on the same volume as your application; when your application starts up, use OpenResFile to open the separate file. This will cause the resource map for the separate file to be searched before the normal application resource file's map (which now contains mostly CODE resources, along with any brand-new resources still being tested).

This will have little or no effect on the rest of your program. Any time that a resource is needed, both resource files will be searched automatically so you don't need to change each GetResource call. (Actually, having the extra resource file open has a minor impact on memory management, and uses one more file-control block; unless you're using a lot of open files at once, or are running at the limits of available memory without segmentation, this shouldn't affect you.)

Once your application is close to being finished, you can use ResEdit to move all the resources back into the main application file, and remove the extra OpenResFile at the beginning of your application. You should do this for any major release (alpha, beta, and any other `heavy-testing' releases). Other minor modifications (such as fine-tuning dialog box item positions) may also be done with ResEdit at this time.

The only catch is that you must be careful if your application adds resources to its own resource file. Most applications do not do this (it's not really a great idea, and causes problems with file servers).

Further Reference:

Previous Technote | Contents | Next Technote