News:

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

Main Menu

Trouble with file length under Win64

Started by Gunther, February 10, 2021, 10:11:00 PM

Previous topic - Next topic

TouEnMasm

Quote
you're right. It was my thought error.
No!,if the error is here,this one is given by the modified msvcrt.
In 32 and 64 bits,the printf function (used by vc_printf) pass it's argument by values not by adress.
It is the vc_printf function who is wrong.
The sample(s) i have posted,use  the printf function and you can verify this.

Quote
printf PROTO cproto :XMASM , :VARARG
;cproto is c in 32 bits and fastcall in 64
Fa is a musical note to play with CL

hutch--

Yves,

If you bothered to look in the 32 bit "msvcrt.inc" file you would see how its done properly.

  ; ------------------------------------------
  ; prototypes for EXPORT msvcrt functions
  ; ------------------------------------------

    c_msvcrt typedef PROTO C :VARARG
........
    externdef _imp__printf:PTR c_msvcrt
    crt_printf equ <_imp__printf>

Calling the function still requires passing the right arguments to it.

TouEnMasm


In the given sample in 64 bits,value is definad as follow:
Quote
Value              dq -1                 ; number to print
uint64_format      db "%I64u", 0         ; unsigned long long

using the official msvcrt and printf to show value,write it like that
Quote
invoke     printf, addr uint64_format,value,value            ;not addr value

Where is the error ?

Fa is a musical note to play with CL

Vortex

Quote from: TouEnMasm on February 13, 2021, 08:18:04 PM

using the official msvcrt and printf to show value,write it like that
Quote
invoke     printf, addr uint64_format,value,value            ;not addr value

Where is the error ?

That the correct way. Mentioned already in my message :

http://masm32.com/board/index.php?topic=9186.msg100864#msg100864

jj2007

include \Masm32\MasmBasic\Res\JBasic.inc ; ## builds in 32- or 64-bit mode with UAsm, ML, AsmC ##
MyQword dq 12345678901234567890
Init ; OPT_64 1 ; put 0 for 32 bit, 1 for 64 bit assembly
  jinvoke crt_printf, Chr$("The value is %I64u"), MyQword
  Inkey Chr$(13, 10, 10, "This program was assembled with ", @AsmUsed$(1), " in ", jbit$, "-bit format.")
EndOfCode


The value is 12345678901234567890

This program was assembled with ml64 in 64-bit format.

hutch--

This is the correct prototype for 64 bit MASM.

externdef __imp_printf:PPROC
vc_printf equ <__imp_printf>

If Yves wants to use the C library, it involves any extra overhead from doing so. In 64 bit MASM the libraries DO NOT HAVE the linker argument count that the 32 bit versions have.