Previous Step: Create application resources.
Back to Top

# Add application resources to your project

Pocket Smalltalk creates "executable" .prc resource databases by merging one or more existing resource databases with resources it generates containing your compiled Smalltalk code. You must therefore tell Pocket Smalltalk which resource databases to include in the final .prc file. At a minimum, you will need to include the virtual machine resource database. This can be found in the Pocket Smalltalk home directory. There are actually two virtual machine databases; the one you should use depends on whether you are planning to use double precision floating-point support:

- vm-math.prc - contains floating-point support
- vm.prc - no floating-point support

For this tutorial, you should use vm.prc, since you will not be using floating-point numbers and floating-point support requires you to install a special math library.

The way to tell Pocket Smalltalk which resource databases to include is to create a named constant for each database. Do this by opening a Constants Browser (Tools/Constants Browser from the Launcher window). Use the Constants Browser menu option Constants/Add resource database... and select the vm.prc file. A new constant named `##resourceDB1` is automatically created, and its value (shown in the bottom pane) is the filename you specified. Pocket Smalltalk will look for constants named `##resourceDB1`, `##resourceDB2`, and so forth, and it will read those files and integrate them into its final "executable" resource database.

Pocket Smalltalk distinguishes between files containing complete resource databases (with extension `.prc`) and files containing single resources (with extension `.bin`). PilRC creates single-resource (`.bin`) files, so you could add a `##resourceDB` constant for each `.bin` file created by PilRC. However, for nontrivial applications there are usually a great many `.bin` files, so you can instead specify a wildcard filename matching the `.bin` files you wish to include. The easiest way to do this is to again use the Add resource database... menu option and this time use the drop-down list at the bottom of the file selection dialog to select files of type "PalmOS Resources". Then select one of the `.bin` files that were created by PilRC. The bottom pane of the Constants Browser will now contain a filename; you should edit the filename from `tFRM0d7a.bin` (or whatever it is) to `*.bin`. Accept with Ctrl-S or the right-button menu. This tells Pocket Smalltalk to search the directory for any `.bin` files and automatically add them to your finished application.

Now is a good time to save your project (System/Save project in the Launcher window). This will record your work so you will not have to do it again if you leave Pocket Smalltalk and come back later.

Next Step: Create an Application class.
Back to Top