printf with asm

Charles Daffern seejay.11 at
Mon Feb 4 11:00:05 PST 2008

You're pushing the pointer to the pointer to the string:

const(char*) mystring = "This number -> %d <- should be 1234\n";
push    dword ptr mystring  ; // pointer into the C-style string

You declared a char* mystring.
The value of mystring is a pointer to the string's data.
You push the pointer of mystring.
Therefore, printf expects a pointer to a string
(ptr -> string data)
but gets a pointer to a pointer.
(ptr -> mystring -> string data)
To solve this, push mystring, not the pointer to mystring.

More information about the D.gnu mailing list