Skip to content

Fix calling a ThisCall delegate via Reverse P/Invoke. - #38829

Merged
jkoritzinsky merged 4 commits into
dotnet:masterfrom
jkoritzinsky:fix-thiscall-reverse-pinvoke
Jul 8, 2020
Merged

jkoritzinsky merged 4 commits into
dotnet:masterfrom
jkoritzinsky:fix-thiscall-reverse-pinvoke

Conversation

@jkoritzinsky

Copy link
Copy Markdown
Member

The m_paramidx value is always -1 for return values, so we ignore it when emitting in case we are using a byref return value that needs a real arg index (which is 0-based).

Fixes #33129

The m_paramidx value is always -1 for return values, so we ignore it when emitting in case we are using a byref return value that needs a real arg index (which is 0-based).

Fixes dotnet#33129
@AaronRobinsonMSFT

AaronRobinsonMSFT commented Jul 6, 2020 •

Copy link
Copy Markdown
Member

The m_paramidx value is always -1 for return values, so we ignore it when emitting in case we are using a byref return value that needs a real arg index (which is 0-based).

The usage of m_paramidx here is amazing. At a minimum we should _ASSERTE(m_paramidx == -1).

@jkoritzinsky

Copy link
Copy Markdown
Member Author

I'll add that in.

@jkoritzinsky
jkoritzinsky force-pushed the fix-thiscall-reverse-pinvoke branch from ae0bcb7 to 08d090b Compare July 6, 2020 23:35
@ghost

ghost commented Jul 6, 2020

Copy link
Copy Markdown

Hello @jkoritzinsky!

Because this pull request has the auto-merge label, I will be glad to assist with helping to merge this pull request once all check-in policies pass.

p.s. you can customize the way I help with merging this pull request, such as holding this pull request until a specific person approves. Simply @mention me (@msftbot) and give me an instruction to get started! Learn more here.

Comment thread src/coreclr/src/vm/dllimport.cpp Resolved
@jkoritzinsky
jkoritzinsky merged commit efdaec6 into dotnet:master Jul 8, 2020
@jkoritzinsky
jkoritzinsky deleted the fix-thiscall-reverse-pinvoke branch July 8, 2020 19:39
@ghost ghost locked as resolved and limited conversation to collaborators Dec 8, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Calli with thiscall convention fails at runtime

3 participants