Author Topic: unresolved external symbol _GetLblAddress@0 ...  (Read 845 times)

sukratu

  • Regular Member
  • *
  • Posts: 6
unresolved external symbol _GetLblAddress@0 ...
« 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.


jj2007

  • Member
  • *****
  • Posts: 7558
  • Assembler is fun ;-)
    • MasmBasic
Re: unresolved external symbol _GetLblAddress@0 ...
« Reply #1 on: December 29, 2015, 07:55:54 PM »
Try extern int __stdcall GetLblAddress(void);

TWell

  • Member
  • ****
  • Posts: 748
Re: unresolved external symbol _GetLblAddress@0 ...
« Reply #2 on: December 29, 2015, 08:07:26 PM »
In C code define
Code: [Select]
extern int __cdecl GetLblAddress(void);Because of your code
Code: [Select]
.model flat, c
...
GetLblAddress PROC
GetLblAddress ENDP

jj2007

  • Member
  • *****
  • Posts: 7558
  • Assembler is fun ;-)
    • MasmBasic
Re: unresolved external symbol _GetLblAddress@0 ...
« Reply #3 on: December 29, 2015, 08:13:31 PM »
oops, that's right: model flat, C

sukratu

  • Regular Member
  • *
  • Posts: 6
Re: unresolved external symbol _GetLblAddress@0 ...
« Reply #4 on: December 29, 2015, 09:38:47 PM »
Hi,

 __cdecl worked! :t

Thanks TWell.