Formalizing @cdecl

Does Delphi use the Pascal calling convention? Embarcadero still sells it as part of RAD Studio, targeting modern platforms including iOS.

@Joe_Groff sadly this is something that I am actively looking into and running into :).

runtime: allow over-aligned types in the runtime by compnerd ยท Pull Request #42143 ยท apple/swift (github.com)
IRGen: setup foreign calls properly by compnerd ยท Pull Request #42157 ยท apple/swift (github.com)
CoreFoundation: correct alignment mis-assumption by compnerd ยท Pull Request #3164 ยท apple/swift-corelibs-foundation (github.com)

were unearthed by reviving the Win32 port for the runtime. I actually am running into problems with calling conventions for foreign functions being dropped on the floor (the current case being closures).

Aha :-) For some reason I had them muddled in my head โ€” probably because Win16 used pascal and then Win32 changed to stdcall so I'd rather assumed that they were the same (I knew they were both callee-pop). I hadn't really appreciated that they'd changed the argument order.

1 Like

Did an official proposal ever come out of this?

6 Likes

Not yet as far as I know. The remaining issues need to be hashed out in a pitch or review cycle.

According to @Joe_Groff :