Skip to content

Adds support for overriding vfuncs to InteropGenerator. - #1943

Open
universalconquistador wants to merge 1 commit into
aers:mainfrom
universalconquistador:interopgenerator-vfunc-overrides
Open

Adds support for overriding vfuncs to InteropGenerator.#1943
universalconquistador wants to merge 1 commit into
aers:mainfrom
universalconquistador:interopgenerator-vfunc-overrides

Conversation

@universalconquistador

@universalconquistador universalconquistador commented Aug 31, 2026

Copy link
Copy Markdown
Contributor

This PR tells InteropGenerator to skip adding vfuncs when there is already a vfunc with the same index further up the inheritance hierarchy.

Pros:
This will be very nice for overriding a ResourceHandle's GetData() to return a specific struct, for example.
This makes IDA decompilation of GetData() calls much nicer, as many of them are represented inline with no variable to change to the concrete type.
image

Cons:
This does not do any verification that the overriding of a vfunc is compatible signature-wise (return type covariant and parameters contravariant and matching parameter count). And because overriding is driven by vfunc index, this also does not enforce the names match. (Although this actually is a benefit, because we can keep the base vfunc in C# with [Obsolete] for backwards compat, and then add the new version of the vfunc with a more specific name)

This will be very nice for overriding a ResourceHandle's GetData() to return a specific struct, for example.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant