KnowledgeBase Archive

An Archive of Early Microsoft KnowledgeBase Articles

View on GitHub

Q27134: The Purpose of Module Definition Files

Article: Q27134
Product(s): See article
Version(s): 5.01.21 5.02 5.03 5.05 5.10 5.13 | 5.01.21 5.02 5.03 5.05
Operating System(s): MS-DOS | OS/2
Keyword(s): ENDUSER | | mspl13_basic
Last Modified: 17-DEC-1990

Module-definition files (.DEF) are used by LINK when building Windows
and OS/2 programs and dynamic-link libraries (DLLs). A .DEF file
describes the name, size, format, functions, and segments of an
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
CODE              Default attributes for code segments
DATA              Default attributes for data segments
SEGMENTS          Attributes for specific segments
STACKSIZE         Local-stack size, in bytes
EXPORTS           Exported functions
IMPORTS           Imported functions
STUB              Adds a DOS Version 3.x executable file to the beginning
                  of the module, usually to terminate the program when
                  run in real mode
HEAPSIZE          Local-heap size, in bytes
PROTMODE          Specifies that the module runs only in OS/2 protected
                  mode
REALMODE          Specifies that the module is for real-mode Windows.
OLD               Preserves export ordinal information from a previous
                  version of the library

The following rules govern the use of these statements in a module-
definitions file:

1. If you use either a NAME or a LIBRARY statement, it must precede
   all other statements in the module-definition file.

2. You can include source-level comments in the module-definition
   file, by beginning a line with a semicolon (;). The OS/2 utilities
   ignore each such comment line.

3. 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.

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.

Copyright Microsoft Corporation 1986-2002.