link error in 64bit assembly file

  • Follow


ULONG64 _cdecl add_wa(ULONG64,ULONG64)is defined in IMT.asm file.
It was called in a cpp file.
The .asm file is like this:
//file begin
   TITLE   IMT.ASM

_TEXT SEGMENT
_add_wa proc PUBLIC
   mov rax,QWORD PTR [esp+8]
   add rax,QWORD PTR [esp+16]
   ret
_add_wa endp

_TEXT ENDS
end
//file end

The files passed the compiling but failed in linking:
error LNK2019: unresolved external symbol "unsigned __int64 __cdecl
add_wa(unsigned __int64,unsigned __int64)
error LNK1120: 1 unresolved externals
BUILD: Done

While copmare to 32bit .asm file there are two lines:
  .586p
  .MODEL flat
But these two lines seems being error to 64bit compiler,even the . is not
allowed.

Searched in google for 64bit compiling and linking information. Seems
mostly are for linux instead of windows.

Has anybody encountered this kind problem? Any sugestion?


0
Reply dongmonkey1 10/6/2004 7:20:11 AM

dongmonkey1 <spamtrap@crayne.org> wrote:
> ULONG64 _cdecl add_wa(ULONG64,ULONG64)is defined in IMT.asm file.
> It was called in a cpp file.
> The .asm file is like this:
> //file begin
>    TITLE   IMT.ASM

> _TEXT SEGMENT
> _add_wa proc PUBLIC
>    mov rax,QWORD PTR [esp+8]
>    add rax,QWORD PTR [esp+16]
>    ret
> _add_wa endp

> _TEXT ENDS
> end
> //file end

> The files passed the compiling but failed in linking:
> error LNK2019: unresolved external symbol "unsigned __int64 __cdecl
> add_wa(unsigned __int64,unsigned __int64)
> error LNK1120: 1 unresolved externals
> BUILD: Done

> While copmare to 32bit .asm file there are two lines:
>   .586p
>   .MODEL flat
> But these two lines seems being error to 64bit compiler,even the . is not
> allowed.

> Searched in google for 64bit compiling and linking information. Seems
> mostly are for linux instead of windows.

> Has anybody encountered this kind problem? Any sugestion?

It doesn't appear that your prototype has a extern "C" in front of it. You
need to do this in C++. See chapter 7 of my on-line tutorial at:
http://www.drpaulcarter.com/pcasm

for details

-- 
Paul Carter 

0
Reply spamtrap 10/6/2004 11:23:52 PM


"dongmonkey1"  <spamtrap@crayne.org> wrote in message news:<856a49610176b41f9d45d80c7622aa5c@localhost.talkaboutprogramming.com>...
> ULONG64 _cdecl add_wa(ULONG64,ULONG64)is defined in IMT.asm file.
> It was called in a cpp file.
> The .asm file is like this:
> //file begin
>    TITLE   IMT.ASM
> 
> _TEXT SEGMENT
> _add_wa proc PUBLIC
>    mov rax,QWORD PTR [esp+8]
>    add rax,QWORD PTR [esp+16]
>    ret
> _add_wa endp
> 
> _TEXT ENDS
> end
> //file end
> 
> The files passed the compiling but failed in linking:
> error LNK2019: unresolved external symbol "unsigned __int64 __cdecl
> add_wa(unsigned __int64,unsigned __int64)
> error LNK1120: 1 unresolved externals
> BUILD: Done
> 
> While copmare to 32bit .asm file there are two lines:
>   .586p
>   .MODEL flat
> But these two lines seems being error to 64bit compiler,even the . is not
> allowed.
> 
> Searched in google for 64bit compiling and linking information. Seems
> mostly are for linux instead of windows.
> 
> Has anybody encountered this kind problem? Any sugestion?


You probably didn't get all of the decoration required on the function
name.  Try making the assembler function name "_add_wa@16".  If that
fails, look in the object file from the C compile to see just what
it's expecting (or try linking with /force and look in the link map).

0
Reply spamtrap 10/7/2004 5:56:14 AM

2 Replies
162 Views

(page loaded in 0.059 seconds)


Reply: