EXTRN Define external Directive
EXTRN definition [, definition ]...
Indicates that a symbol is defined in another module. definition
describes a symbol and has the following format:
[language] name [[count1]] :complex_type [:count2]
- language specifies that the naming conventions of C, CPP, PASCAL,
BASIC, FORTRAN, NOLANGUAGE, or PROLOG are to be applied to symbol
name; temporarily overrides language set with a MODEL statement
- name is the symbol that is defined in another module (must be
declared as GLOBAL, PUBLIC, or PUBLICDLL in order for your program
to link properly) and can optionally be followed by:
- count1, an array element multiplier that defaults to 1
- complex_type must match the type of the symbol where it's defined
(the ABS type is used for symbols that represent absolute numbers)
- count2 specifies how many items this external symbol defines
and defaults to one if not specified.
Examples: EXTRN memptr:DWORD
EXTRN C carray[32]:WORD:400
You can use the EXTRN directive either inside or outside a segment
declared with the SEGMENT directive. If you place EXTRN inside a
segment, you are informing the assembler that the external variable is
in another module but in the same segment. If you place the EXTRN
directive ouside of any segment, you are informing the assembler that
you don't know which segment the variable is declared in.
In MASM mode, external symbols declared outside of any segment are
presumed to be reachable via the DS register, which may not always be
a valid assumption. Make sure that you either place the correct
segment value in DS, or use an explicit segment override when
referring to these variables.
In Ideal mode, Turbo Assembler correctly checks for whether the
external variable is addressable using any of the current segment
registers, as described with the ASSUME directive.