The Purpose of Module Definition Files

Last reviewed: January 24, 1995
Article ID: Q27134

The information in this article applies to:

  • Microsoft LINK for MS-DOS, versions 5.0x, 5.1x, 5.3, 5.31.009, 5.5, and 5.6
  • Microsoft LINK for OS/2, versions 5.01.21, 5.02, 5.03, 5.05, 5.1, and 5.13
  • Microsoft LINK for Windows NT, versions 1.0 and 2.5

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:
  • If you use a NAME or a LIBRARY statement (recommended), it must precede all other statements in the module-definition file.
  • You can include source-level comments in the module-definition file, by beginning a line with a semicolon (;). The utilities ignore each such comment line.
  • Module-definition keywords (such as NAME, LIBRARY, and SEGMENTS) must be entered in uppercase letters.

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


THE INFORMATION PROVIDED IN THE MICROSOFT KNOWLEDGE BASE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. MICROSOFT DISCLAIMS ALL WARRANTIES, EITHER EXPRESS OR IMPLIED, INCLUDING THE WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL MICROSOFT CORPORATION OR ITS SUPPLIERS BE LIABLE FOR ANY DAMAGES WHATSOEVER INCLUDING DIRECT, INDIRECT, INCIDENTAL, CONSEQUENTIAL, LOSS OF BUSINESS PROFITS OR SPECIAL DAMAGES, EVEN IF MICROSOFT CORPORATION OR ITS SUPPLIERS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. SOME STATES DO NOT ALLOW THE EXCLUSION OR LIMITATION OF LIABILITY FOR CONSEQUENTIAL OR INCIDENTAL DAMAGES SO THE FOREGOING LIMITATION MAY NOT APPLY.

Last reviewed: January 24, 1995
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.