DBSLib Driver Application

In this section, we show how to use the shared library from a conventional Palm application. We assume you are familiar with developing C/C++ Palm applications using CodeWarrior, so we focus on the code used to access the shared library.

Our driver application is called DBSLibFuser, because we expect to eventually turn it into an AppForge fuser. The main screen for our driver is shown in Figure 8-1.

DBSLib driver application

Figure 8-1. DBSLib driver application

The main screen consists of three buttons that make calls into the DBSLib shared library. GetAPI retrieves the API version of our library by calling DBSLibGetAPIVersion. CreateDB calls DBSLibParseSchema with a hardcoded XML string to create a fictitious Employee database. GetDBInfo calls DBSLibGetDBInfo to retrieve metadata for the newly created Employee database.

An application using a shared library performs five basic operations, as shown in Table 8-5.

Table 8-5. Library operations

Operation

Description

Load

Finds and loads the library.

Open

Opens the library for use. This step is required before calling the library’s functions.

Use

Makes calls into the library.

Close

Closes the library when done.

Unload

Unloads the library if you are the only one using it.

Load and Open

We use the following structure to track information about the shared library we are loading.

typedef struct ShLibInfoType { UInt16 nLibRefNum; ...

Get Programming Visual Basic for the Palm OS now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.