Author Topic: call _printf  (Read 17776 times)

nobody

  • Guest
call _printf
« on: September 16, 2009, 03:16:35 AM »
I use NASM under Windows,and in my asm I want to call C runtime function printf, like this

'push msg

call _printf

add esp, 4`


But when program run, it does not call printf function but another fuction.If code like this:

push msg

mov eax, _printf

call eax

add esp, 4

It works well.Why?

Thanks!

Offline Frank Kotler

  • NASM Developer
  • Hero Member
  • *****
  • Posts: 2667
  • Country: us
Re: call _printf
« Reply #1 on: September 16, 2009, 11:47:16 PM »
Dunno. Doesn't seem possible. What function does it call besides _printf?

Best,
Frank

nobody

  • Guest
Re: call _printf
« Reply #2 on: September 17, 2009, 01:32:33 AM »
The function is not confirmed.But it is not printf.

BTW,my NASM is 2.04.

Thanks!

Offline Frank Kotler

  • NASM Developer
  • Hero Member
  • *****
  • Posts: 2667
  • Country: us
Re: call _printf
« Reply #3 on: September 17, 2009, 03:57:00 PM »
Odd. Well, put it in eax, if that works. Shouldn't make any difference. Are you using "-f obj"? If so, "call [_printf]" may work...

Best,
Frank