To use this library, the user makes a call to _CP_logon() at the beginning of the C program to connect to the D3 virtual machine. This call goes through the normal D3 logon activities, but suppresses all user prompts and messages. Note that neither the user nor the MD macro will be executed. After logging on, the user has full access to the D3 database using C calls that provide functionality previously available only through FlashBASIC. When the C program completes, the user must issue a _CP_logoff() call to terminate the D3 connection.
The standard C string type is not sufficient for handling the dynamic nature of D3 strings, so a hybrid data type has been created called CPSTR. This data type provides allocation, deallocation, and resizing of strings at a much higher performance level than that obtained using malloc() and free() with C strings.
To make it easier to handle the differences between the standard behavior of UNIX programs and the standard behavior of D3 programs, two calls are provided that set the environment to either D3 or UNIX.
D3 interrupts, besides breaks such as messages, can not be masked, but can be detected (after the occurrence) by interrogating the _CP_interrupt variable. This integer location contains the same information available in BASIC from the system(37) function. However, an examination of _CP_interrupt is much more efficient when programming in C.
The D3 libraries make extensive use of signal processing. Because of this, the practice of reprogramming signals within a C application using D3 C routines is strongly discouraged. However, if it is absolutely necessary, there are several rules which must be followed.