DBSLib Fuser

In this section, we modify the DBSLib driver application and create an AppForge fuser. This allows an AppForge VB application to access the shared library.

To convert the driver application to a fuser, you need to change its database type to FUSR. You must also set the structure alignment to 68K 4-byte in the 68K Processor panel of the project’s settings. Make sure to recompile the project after making these changes.

Data Types

For use as a fuser, we define the following launch codes.

#define dbsFuserAppLaunchGetAPI   32767
#define dbsFuserAppLaunchCreateDB 32768

The dbsFuserAppLaunchGetAPI launch code corresponds to DBSLibGetAPI. To marshal data for this launch code, we use the following structure.

typedef struct DBSLibAPIStruct
{
  Int16 nMajor;        /* OUT */
  Int16 nMinor;        /* OUT */
  UInt32 nResult;      /* OUT */
} DBSLibAPIStruct;

We receive the IN items from the AppForge application and we pass the OUT items back to it. Here we only have OUT items. nMajor and nMinor are the major and minor numbers, respectively, of our library’s version. nResult is the result of processing this launch code. 0 means success, 1 means failure.

We then combine CreateDatabase and GetDBInfo into one launch code—dbsFuserAppLaunchCreateDB. Since a fuser’s global data is not generally available while processing a launch code, we must open and close the library each time.[59] This makes it difficult to maintain state between launch codes. Thus, we combine these two functions into one launch code.

We use ...

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.