Source Files, Compilation, and Linking
All of the required structures can be obtained by writing the application in C Language, or by following the program structure produced by the C compiler. C code should be compiled with the following switches:
- /AS - generate near calls and pointer references.
- /Gs - disable insertion of stack probe.
- /DAPI2 - defines API2, allowing INTERFAC.H and INTERFAC.MAC to generate 100LX/200LX compatible calls. Without this switch, only 95LX compatible calls can be made.
- /G1 - recommended to make smaller code. The 100LX/200LX is a 80186 chip, which provides an immediate value push instruction; use of this switch will eliminate a lot of overhead generated by the C compiler when pushing arguments on the stack.
- /Zp1 - recommended to make smaller data. This packs data structures--all structures defined in the SystemManager, LHAPI, and the Database Engine use byte-aligned data structures.
Applications generally should not use the standard run-time libraries, but should use System Manager Services wherever possible. Safe versions of library functions used by the various applications should be collected into a single source library, although each linked application will have its own copy of that code.
To test applications on a PC during development, the System Manager services are available through a TSR (TKERNEL.EXE). Applications can be developed as DOS programs which use the standard run-time library's startup code (CRT0, etc.). To convert the program into an application that can be launched directly by the System Manager, the startup code is replaced with the System Manager-specific startup code (SMCRT0) at link time. This .EXE may then be used as input to E2M, or used for testing under tkernel on the PC.