Hi,
My problem is one of "unresolved external" when linking the two
windows modules listed below.
Each mod assembles with no error.
The only unresolved external is the procedure Hex2Dec
The linker sees the variables DecStorage and Quotient o.k.
I think I've exhausted every combination of EXTRN,EXTERN,NEAR,FAR,PROC,DWORD
and nothing makes a difference.
I tried modifying Hex2Dec to _Hex2Dec since that's what the linker seemed
to want but that didn't work either.
;------------------------
;TEMPLATE.ASM - main mod.
.586
.model flat, stdcall
option casemap :none
extrn DecStorage:near
extrn Quotient:near
extrn Hex2Dec:proc
;--------------------
;H2D.ASM - called mod.
.586
.model flat, stdcall
option casemap :none
public DecStorage
public Quotient
public Hex2Dec
;------------------------------------
;These are the assembly/link commands.
;------------------------------------
ml /c /coff /Cp template.asm
ml /c /coff /Cp h2d.asm
link_51 /subsystem:windows template.obj h2d.obj
;----------------------
;This is the error.
;----------------------
template.obj : error LNK2001: unresolved external symbol _Hex2Dec
template.exe : fatal error LNK1120: 1 unresolved externals
;---------------------------
;These are the weapons
;--------------------------
Microsoft (R) Macro Assembler Version 6.14.8444
Copyright (C) Microsoft Corp 1981-1997
Microsoft (R) Incremental Linker Version 5.12.8181
Copyright (C) Microsoft Corp 1992-1998. All rights reserved.
Windows 2000 Pro. Version 5.0 Build 2195: Service Pack 4
;----------------------------------------
Thanks in advance for any attention.
afk
includelib \masm32\lib\masm32.lib
This will work, but there are other possibilities.
template.asm:
; «««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««
include \masm32\include\masm32rt.inc
; «««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««
extern DecStorage: dword
extern Quotient: dword
extern Hex2Dec: proto
;externdef DecStorage: dword
;externdef Quotient: dword
;externdef Hex2Dec: proto
; «««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««
.data
.code
; «««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««
start:
; «««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««
call Hex2Dec
exit
; «««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««
end start
h2d.asm:
; «««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««
include \masm32\include\masm32rt.inc
; «««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««
public DecStorage
public Quotient
;externdef DecStorage: dword
;externdef Quotient: dword
; «««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««
.data
DecStorage dd 0
Quotient dd 0
.code
; «««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««
Hex2Dec proc
MsgBox 0,"Hex2Dec","Hex2Dec",0
ret
Hex2Dec endp
; «««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««
end
makeit.bat:
if exist "h2d.obj" del "h2d.obj"
if exist "template.exe" del "template.exe"
if exist "template.obj" del "template.obj"
\masm32\bin\ml /c /coff "h2d.asm"
pause
\masm32\bin\ml /c /coff "template.asm"
pause
\masm32\bin\Link /SUBSYSTEM:WINDOWS "template.obj" "h2d.obj"
pause
I think it would be better to use EXTERNDEF in both source files.
Ultrano, I tried includelib \masm32\lib\masm32.lib
but the problem remained. I wondered if it were because I had an old version (6) of masm32
so I downloaded v9 but the results were the same. ;-(
Michael, thanks for the code. It works. It raised as many questions as it answered and that's good.
Austin
;------------------------------------------------------------------------------------------------------------------------------------------
I had tacked on a question here about Windows/Linux which I discovered was already answered in Campus. I apologize if anyone has started to reply.
;-------------------------------------------------------------------------------------------------------------------------------------------