You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hack for supporting MSVC x64 instance method calling convention until Rust compiler supports it natively
Instance methods like `ReturnType myMethod(T arg1, U arg2)` where ReturnType is non trivial are passed in MSVC as:
rcx - this
rdx - address of return value
r8, r9 - arg1, arg2
But the extern "C" abi passes arguments to a function `ReturnType myFunction(ThisType* this, T arg1, U arg2)` as follows:
rcx - address of return value
rdx - this
r8, r9 - arg1, arg2
The MSVC convention for x64 is similar to x86 thiscall. Thus, we can rewrite the methods returning non-trivial values to be functions returning void, passing the return value via the second argument (after the this pointer). This will enable them to be called correctly with the new signature using extern "C" abi.
See <rust-lang/rust#38258>
0 commit comments