Linkage question

duser duser at neet.fi
Tue Jan 25 05:43:06 UTC 2022


On Monday, 24 January 2022 at 19:41:30 UTC, frame wrote:
> On Monday, 24 January 2022 at 18:30:02 UTC, Stanislav Blinov 
> wrote:
>
>> The difference is in how arguments are being passed, which you 
>> seem to have discovered already :)
>>
>>> Would like to know where the linkage format is defined, thx.
>>
>> It should be here: https://dlang.org/spec/abi.html although 
>> IIRC it might not be 100% up to date.
>
> Ah, yes. Thanks. Maybe I should read it more carefully =)
>
> It claims that the D calling convention matches C. But it seems 
> that the arguments are pushed in order whereas C does it in 
> reverse order and the -218697648 value is indeed my 3rd string 
> pointer.

that's a bug with dmd or the spec, arguments are currently passed 
in reverse order compared to C on 64-bit even though they should 
be the same

see:
https://issues.dlang.org/show_bug.cgi?id=20204
https://github.com/dlang/dmd/pull/13287
https://github.com/dlang/dlang.org/pull/3120


More information about the Digitalmars-d-learn mailing list