Initializing the Spelling Session with Single and Multiple Applications

Initializing a spelling session requires the device to load a set of data into active memory. Further, the initialization process might reserve a large amount of resources. Monopolizing resources might not be a problem if a user is running only one application on the device. However, you need to take into account the possibility that other applications may need to use the spelling checker at the same time as your application.

In situations where you can be certain that only one application uses the spelling checker, initialize the spelling session when the application starts. Initializing the spelling checker at the beginning of an application means that you can avoid unnecessary processing in the middle of your application. Similarly, keep the spelling session active until the application ends.

Initializing a spelling session is different when you program in a multiple-application environment. A spelling session has exclusive access to external user directories until the calling application closes the spelling session. This means that a second application cannot load external user dictionaries already in use. Therefore, if your application runs in an environment where other applications use the spelling checker, you may want to initialize the spelling checker when the application requests it. Initializing the spelling checker only when an application needs it reduces the number of external user dictionaries tied up in any given application. When the application is done with the spelling checker, call the SplQuit function to release the dictionaries so that other applications can use them.

The main directory is available for multiple spelling sessions because it is read-only. The internal user directories are created for each spelling session and are removed at the end of each spelling session. Therefore, access to the internal user dictionaries by multiple spelling sessions is not a concern.