News:

Masm32 SDK description, downloads and other helpful links
Message to All Guests

Main Menu

Is it printf or _printf?

Started by Gunther, October 01, 2012, 12:48:35 AM

Previous topic - Next topic

Gunther

I need some help for the Windows 64 bit environment. Since I haven't running a 64 bit windows, I hope one of the members can answer. If one would call the LIBC from an assembly language application, is it:
call printf
or
call _printf

Thank you.

Gunther

You have to know the facts before you can distort them.

qWord

MREAL macros - when you need floating point arithmetic while assembling!

Vortex

Also, the same is true for msvcrt.dll. The function is exported as printf

Gunther

Thank you for the information. In the 32 bit world it's _printf.

Gunther
You have to know the facts before you can distort them.

jj2007

Quote from: Gunther on October 01, 2012, 09:22:00 AM
Thank you for the information. In the 32 bit world it's _printf.

Gunther

In the Masm32 world it seems to be printf: call crt_printf ;)

MichaelW

Quote from: Gunther on October 01, 2012, 09:22:00 AM
In the 32 bit world it's _printf.

I know for some CRTs it is, the lcclibc.dll that I tested recently for example, but for MSVCRT.dll, on my Windows 2000 system and on my Windows XP system, it's "printf".

;==============================================================================
; Build as a console app.
;==============================================================================
include \masm32\include\masm32rt.inc
;==============================================================================
.data
    hMod dd 0
.code
;==============================================================================
start:
;==============================================================================
    invoke LoadLibrary, chr$("msvcrt.dll")
    mov hMod, eax
    printf("%Xh\n",hMod)
    invoke GetProcAddress, hMod, chr$("printf")
    mov ebx, eax
    printf("%Xh\n\n",ebx)

    push ebx
    push cfm$("%Xh\n\n")
    call ebx
    add esp, 8

    inkey
    exit
;==============================================================================
end start


78000000h
78023626h

78023626h

Well Microsoft, here's another nice mess you've gotten us into.