digitalmars.com                        
Last update Sun Sep 8 21:42:02 2013

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:

What's in This Chapter

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: Note: The Virtual memory model (-mv) and the Virtual Code Management system are no longer supported.

32-bit protected mode memory models

If your compilation will run in 32-bit protected mode, you can use either of these two models: The DOSX memory model (-mx) is compatible with the DOSX 386 DOS extender, available from Flashtek. The Phar Lap memory model (-mp) is compatible with the Phar Lap 32-bit DOS extender, available from Phar Lap.

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
Home | Runtime Library | IDDE Reference | STL | Search | Download | Forums