The MASM Forum

Specialised Projects => Compiler Based Assembler => Assembler With Microsoft Visual C => Topic started by: sukratu on December 29, 2015, 05:57:34 PM

Title: unresolved external symbol _GetLblAddress@0 ...
Post by: sukratu on December 29, 2015, 05:57:34 PM
Hi,
I am getting a linker error like
error LNK2019: unresolved external symbol _GetLblAddress@0 referenced in function _callasm@0..
where GetLblAddress is defined in separate asm file.
I am using VS 2013 project and compiling it as win32 project ("/TC")

.asm code
-----------------------------------------------------------
.586
.model flat, c

.code

PUBLIC GetLblAddress

GetLblAddress PROC
   
    //some assembly code
    //some assembly code

           ret

GetLblAddress ENDP

END

.C code
-----------------------------------------------------------
extern int GetLblAddress();
void callasm()
{
    int lbl = GetLblAddress();
    printf(...);
}

in compilation I am getting linker error.
I tried changing the name to _GetLblAddress but still getting same error.

Title: Re: unresolved external symbol _GetLblAddress@0 ...
Post by: jj2007 on December 29, 2015, 07:55:54 PM
Try extern int __stdcall GetLblAddress(void);
Title: Re: unresolved external symbol _GetLblAddress@0 ...
Post by: TWell on December 29, 2015, 08:07:26 PM
In C code define
extern int __cdecl GetLblAddress(void);
Because of your code.model flat, c
...
GetLblAddress PROC
GetLblAddress ENDP
Title: Re: unresolved external symbol _GetLblAddress@0 ...
Post by: jj2007 on December 29, 2015, 08:13:31 PM
oops, that's right: model flat, C
Title: Re: unresolved external symbol _GetLblAddress@0 ...
Post by: sukratu on December 29, 2015, 09:38:47 PM
Hi,

__cdecl worked! :t

Thanks TWell.