DOS Programming Guidelines
This chapter describes how to use the compiler and linker to create DOS programs. For the compiler, it explains how to choose a memory model. For the linker, it describes switches and definition (.def) file syntax for linking DOS objects.For information about:
- Using the IDDE to create DOS applications, see the User's Guide and Reference.
- Creating WINIO applications, see the Run-Time Library Reference.
- Creating Windows 3.1 applications and DLLs, see Win16 Programming Guidelines.
- Win32 and Win32s programming, see Win32 Programming Guidelines.
What's in This Chapter
- An overview of how to choose a memory model for a DOS program.
- Definition file directives for DOS programs.
Choosing a Memory Model for DOS Programs
This section provides an overview of how to choose a memory model when compiling DOS programs.For a detailed description of all the memory models and guidelines for when to use each one, see Choosing a Memory Model.
Real mode memory models
You can use these memory models for real mode DOS programs:- Tiny (-mt compiler option)
- Small (-ms compiler option)
- Medium (-mm compiler option)
- Compact (-mc compiler option)
- Large (-ml compiler option)
32-bit protected mode memory models
If your compilation will run in 32-bit protected mode, you can use either of these two models:- DOSX (-mx compiler option)
- Phar Lap (-mp compiler option)
Always try to compile all the files in a DOS application with the same memory model or explicitly declare a type for each pointer in a function prototype. If you are mixing near and far data references, make sure that all declarations match their corresponding definitions, or hard-to-find bugs can result.
For more information, see Choosing a Memory Model.
Definition File Directives
You use the following directives in definition files for DOS and DOSX programs. For information on these directives see Definition File Directives.EXETYPE [DOSX | DOS] REALMODE STACKSIZE number