Linux 64bit Calling Convention
Trass3r via Digitalmars-d
digitalmars-d at puremagic.com
Sat Oct 25 04:21:37 PDT 2014
On Thursday, 28 February 2013 at 01:03:08 UTC, Maxime Chevalier
wrote:
> I did some further testing:
>
> void foo(int a, int b)
> {
> writefln("a: %s", a);
> writefln("b: %s", b);
> }
>
> unittest
> {
> foo(1, 2);
>
> asm
> {
> mov RDI, 1;
> mov RSI, 2;
> call foo;
> }
> }
>
> Produces:
>
> a: 1
> b: 2
> a: 2
> b: 1
>
> Unless I'm mistaken, DMD does not respect the C calling
> convention on Linux/AMD64.
True.
For extern(D) dmd passes parameters in reverse order on Win64 and
Linux64!
What the heck?
More information about the Digitalmars-d
mailing list