The Purpose of Module Definition Files

ID: Q27134

The information in this article applies to:

When the LINK utility builds an application or a dynamic-link library (DLL) for the Microsoft Windows, Windows NT, OS/2 operating systems, or a MOVE overlaid application for MS-DOS, a module-definition (.DEF) file may be needed. Most 32-bit programs for Windows NT do not require a DEF file, while most 16-bit programs for Windows require a DEF file. A DEF file defines the name, size, format, functions, and segments for the application or DLL.

A module-definition file contains one or more module statements. Each module statement defines an attribute of the executable file. The module statements and the attributes they define are listed below:

   Statement      Attribute
   -------------------------------------------------------------------

   NAME           Name and type of application

   LIBRARY        Name of dynamic-link library

   DESCRIPTION    One-line description of the module

   STUB           Adds a MS-DOS executable file to the beginning of
                  the module. Usually, this program terminates
                  execution when Windows is not running or when the
                  application runs in real mode. (16-bit target only).

   APPLOADER      Replaces default Windows loader with a custom loader.
                  (16-bit target only)

   EXETYPE        Identifies the target operating system.
                  (16-bit target only)

   PROTMODE       Specifies that the module runs only in protected
                  mode OS/2. (16-bit target only)

   REALMODE       Specifies that the module is for real-mode Windows.
                  (16-bit target only)

   STACKSIZE      Local-stack size, in bytes.

   HEAPSIZE       Local-heap size, in bytes.
                  (16-bit target only)

   CODE           Default attributes for code segments.

   DATA           Default attributes for data segments.

   SECTIONS       Defines the attributes for specific sections.
                  (32-bit target only)

   SEGMENTS       Attributes for specific segments. (16-bit target only)

   OLD            Preserves export ordinal information from a previous
                  version of the library (DLL). (16-bit target only)

   EXPORTS        Exported functions.

   VERSION        Writes a user specified version number in the
                  image header. (32-bit target only)

   IMPORTS        Imported functions. (16-bit target only)

   FUNCTIONS      Specifies a function order and location.
                  (16-bit target only)

   INCLUDE        Inserts a file containing module statements.
                  (16-bit target only)

The following three rules govern the use of these statements in a DEF file: For more information, refer to the utility reference or online help that accompanied your particular compiler or assembler.

Additional reference words: kbinf kbinf 5.01.21 5.02 5.03 5.05 5.10 5.13 5.30 5.31.009 5.50 5.60 1.00 2.50 KBCategory: kbtool KBSubcategory: LinkIss

Last Reviewed: January 24, 1995