Assembly Language Help (alang.hlp) (Table of Contents; Topic list)
Important Notice
The pages on this site contain documentation for very old MS-DOS software, purely for historical purposes. If you're looking for up-to-date documentation, particularly for programming, you should not rely on the information found here, as it will be woefully out of date.
EXTERNDEF/COMM Diagram
                                             Up Contents Index Back
────────────────────────────────────────────────────────────────────────────
 
     Variables can be shared between source files in the following
     manner:
 
                      ┌─TOOLS.INC────────────────┐
                      │                          │
                      │ EXTERNDEF  Global: WORD  │─Declaration
                      │ COMM       Communal: WORD│─Declaration &
                      └────────────┬─────────────┘  definition
                                   │
                  ┌────────────────┴─────────────────┐
                  │                                  │
     ┌─USER.ASM───┴──────────┐          ┌─TOOLS.ASM──┴──────────┐
     │                       │          │                       │
     │ INCLUDE   TOOLS.INC   │          │ INCLUDE   TOOLS.INC   │
     │                       │          │                       │
     │ mov       Global, ax  │┬─Use    │ Global    WORD ?      │─Definition
     │ mov       bx, Communal│┘        │                       │
     └───────────────────────┘          └───────────────────────┘
 
     The EXTERNDEF directive in TOOLS.INC declares the variable Global
     and allows it to be accessed within modules that include
     TOOLS.INC, such as USER.ASM. The EXTERNDEF directive does not
     define Global; it is created by TOOLS.ASM. If TOOLS.INC is
     included by a module that does not use Global, the linker will not
     import Global.
 
     The COMM directive in TOOLS.INC declares and defines the variable
     Communal and exports it to all modules that include TOOLS.INC,
     regardless of whether or not Communal is used.
                                    -♦-