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 ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access