问题
I saw in several places that Microsoft calling conventions for x64
platforms were narrowed down to just one: Caller cleans stack (cdecl
), and parameters are passed in a combination of stack and registers (I am not going into the exact details here). I assume that if this is the calling convention of the OS, then probably all other compilers targeting Windows (e.g. mingw-w64) follow it, too.
Is this calling convention true also on other major platforms (x64
Linux, etc.)? Or does Linux still use multiple calling conventions, or even just one but a different one? Do GCC
or Clang
allow for multiple calling conventions on x64
Linux?
回答1:
I just found the answer here and here. Basically, Windows does it one way, everyone else does it another way, but each platform only does it one way (as opposed to multiple ways per-platform with x86
)
来源:https://stackoverflow.com/questions/18135871/calling-convention-on-x64