printf with asm
Manfred Hansen
m.hansen at kielnet.net
Mon Nov 5 11:27:55 PST 2007
void main()
{
int myint = 1234;
const(char*) mystring = "This number -> %d <- should be 1234\n";
asm
{
push dword ptr myint ; // pointer to the integer variable
declared in D
push dword ptr mystring ; // pointer into the C-style string
declared in D
call printf ; // call the printf function
}
}
This programm run with dmd 2.007 but not with gdc based on version 2.005 .
My Compiler is gcc.4.1.2 under linux.
The output:
manni at manni-lx:~/dd/ass$ ./asm
This number -> 1234 <- should be 1234
Speicherzugriffsfehler (core dumped)
I believe the core dump has to with the line
const(char*) mystring ...
manni
-------------- next part --------------
A non-text attachment was scrubbed...
Name: core.bz2
Type: application/x-bzip2
Size: 20119 bytes
Desc: not available
Url : http://lists.puremagic.com/pipermail/d.gnu/attachments/20071105/316b8b74/attachment.bin
More information about the D.gnu
mailing list