NASM - The Netwide Assembler

NASM Forum => Using NASM => Topic started by: nobody on September 16, 2009, 03:16:35 AM

Title: call _printf
Post by: nobody 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!
Title: Re: call _printf
Post by: Frank Kotler on September 16, 2009, 11:47:16 PM
Dunno. Doesn't seem possible. What function does it call besides _printf?

Best,
Frank
Title: Re: call _printf
Post by: nobody 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!
Title: Re: call _printf
Post by: Frank Kotler 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