Skip to content
This repository has been archived by the owner on Jan 23, 2023. It is now read-only.

Port .NET 5 fix for reverse P/Invoke marshalling of structs. #28117

Closed
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/vm/dllimport.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3836,10 +3836,10 @@ static void CreateNDirectStubWorker(StubState* pss,
// For functions with value type class, managed and unmanaged calling convention differ
fMarshalReturnValueFirst = HasRetBuffArgUnmanagedFixup(&msig);
#elif defined(_TARGET_ARM_)
fMarshalReturnValueFirst = HasRetBuffArg(&msig);
fMarshalReturnValueFirst = (isInstanceMethod && isReturnTypeValueType) && HasRetBuffArg(&msig);
#else
// On Windows-X86, the native signature might need a return buffer when the managed doesn't (specifically when the native signature is a member function).
fMarshalReturnValueFirst = HasRetBuffArg(&msig) || (isInstanceMethod && isReturnTypeValueType);
fMarshalReturnValueFirst = (!SF_IsReverseStub(dwStubFlags) && HasRetBuffArg(&msig)) || (isInstanceMethod && isReturnTypeValueType);
#endif // UNIX_X86_ABI
#elif defined(_TARGET_AMD64_) || defined (_TARGET_ARM64_)
fMarshalReturnValueFirst = isInstanceMethod && isReturnTypeValueType;
Expand Down