Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Introduce a source generator for invoking methods on unmanaged vtables #68276

Merged
merged 40 commits into from
Oct 11, 2022

Conversation

jkoritzinsky
Copy link
Member

@jkoritzinsky jkoritzinsky commented Apr 20, 2022

This PR introduces a source generator that supports invoking native function pointers that are defined sequentially in memory (like in a static table or a vtable). This generator is a first step towards our COM source generator and provides a more focused testing ground for the managed->native and native->managed marshalling stubs while also enabling us to move some non-COM dotnet/runtime code to use auto-generated interop stubs.

@ghost
Copy link

ghost commented Apr 20, 2022

Tagging subscribers to this area: @dotnet/interop-contrib
See info in area-owners.md if you want to be subscribed.

Issue Details

This PR introduces a source generator that supports invoking native function pointers that are defined sequentially in memory (like in a static table or a vtable). This generator is a first step towards our COM source generator and provides a more focused testing ground for the managed->native and native->managed marshalling stubs while also enabling us to move some non-COM dotnet/runtime code to use auto-generated interop stubs (in particular, this generator would allow us to remove the manually-generated code from System.Net.Quic's MSQuic implementation).

Depends on #67997

Author: jkoritzinsky
Assignees: jkoritzinsky
Labels:

area-System.Runtime.InteropServices

Milestone: -

@jkoritzinsky jkoritzinsky added the source-generator Indicates an issue with a source generator feature label Apr 20, 2022
@jkoritzinsky jkoritzinsky marked this pull request as ready for review May 13, 2022 23:20
@jkoritzinsky
Copy link
Member Author

I've marked this PR as ready for review as it has enough infrastructure to be useful and it has some basic testing. I still need to add the runtime tests.

@lambdageek
Copy link
Member

attn @lateralusX this is potentially interesting for some of your favorite platforms

…Environment to avoid rooting the compilation. Update all generators to follow suit and add a test in LibraryImportGenerator to validate that we don't keep the compilation alive.

Also fix the build failure in ComInterfaceGenerator
@jkoritzinsky
Copy link
Member Author

Wasm build tests failure is #76429

…s that have occured in our policy since this branch was started
@build-analysis build-analysis bot mentioned this pull request Oct 10, 2022
2 tasks
@jkoritzinsky
Copy link
Member Author

All failures are dotnet/arcade#10885

@jkoritzinsky jkoritzinsky merged commit e139ffb into dotnet:main Oct 11, 2022
@jkoritzinsky jkoritzinsky deleted the vtable-stubs branch October 11, 2022 21:27
@ghost ghost locked as resolved and limited conversation to collaborators Nov 11, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area-System.Runtime.InteropServices source-generator Indicates an issue with a source generator feature
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants