I have 2 files:
m2:
.model small
.stack 100h
.data
global print ;######4######
.code
main:
MOV AX, @data
MOV DS, AX
print proc ;expects information from DX
MOV AH,9
INT 21h
ENDP
MOV AH, 4ch
INT 21h
END main
m1:
.model small
.stack 100h
.data
str1 DB 'hello $'
.code
EXTRN print:far
main:
MOV AX, @data
MOV DS, AX
MOV DX, OFFSET str1
CALL print
MOV AH, 4ch
INT 21h
END main
I tried to figure out how to link the two files using this explanation but it is for NASM, while I am using TASM and I had a problem.
I linked both files, but while assembling m2 I got a warning :
global type doesn't match symbol : PRINT.
I tried to remove line 4 , but then I couldn't link m1, m2 and recieved a warning :
undefined symbol PRINT in module M1.ASM
I also tried to remove the keyword far
from the m1.asm file... no use either.
My question is how to remove the warning and be able to link the two files?
Just give the symbol a consistent typing.
The easiest approach is to use PROC
to let the assembler pick up the correct type:
m2.asm
...
GLOBAL print: PROC
...
m1.asm
...
EXTRN print: PROC
...
Otherwise, you can declare the symbol with type NEAR
or FAR
(use it in place of PROC
), just be sure to properly define the function too (e.g. print PROC FAR
).
For a complete list of types, see chapter 5 of the TASM manual.