The EXTERNDEF directive combines the functionality of the EXTERN/EXTRN and PUBLIC directives. It provides a uniform way to declare global symbols that are to be shared across multiple modules.
Syntax
EXTERNDEF [Language-Name] Name:Type [, ...]
Where Type is one of:
A symbol declared with EXTERNDEF is treated as PUBLIC if a definition for the symbol is encountered during the assembly, otherwise the symbol is assumed to be defined in another module and is treated as if it were declared with the EXTERN/EXTRN directive.
The following example shows how a declaration for the ReturnCode symbol can be shared between two modules (Main.asm and FileErr.asm) by way of a common header file (ErrNum.inc):
; ---------------------------------------------------------------------- ; ErrNum.inc RETCODE_T typedef DWORD RC_NoError equ 0 RC_FileNotFound equ 1 RC_SystemError equ 3 EXTERNDEF ReturnCode:RETCODE_T ; declaration ; ---------------------------------------------------------------------- ; FileErr.asm .386 .MODEL FLAT INCLUDE ErrNum.inc ; bring in error number definitions ; and declaration for ReturnCode .CODE ; Tell the user about the file error, ; then make sure the program has a non-zero exit status FileError proc ... mov ReturnCode, RC_FileNotFound ret FileError endp end ; ---------------------------------------------------------------------- ; Main.asm .386 .MODEL FLAT INCLUDE ErrNum.inc ; bring in error number definitions ; and declaration for ReturnCode EXTERNDEF FileError:PROC ; This could be in a common header too .DATA ReturnCode RETCODE_T RC_NoError ; actual definition of ReturnCode .CODE Main proc ... ... call FileError ; hypothetical error condition ... ... mov eax, ReturnCode ; load the exit status call Exit ; and shutdown the program Main endp end Main