Repository navigation
Conversation
Define named unmanaged delegates for anonymous MI function pointers and remap the corresponding struct fields and callback parameters to those delegates. Add metadata regression tests for callable types and representative signatures. Fixes microsoft#842. Co-authored-by: Codex <[email protected]>
Perdixky
requested review from
a team,
Jevan Saks (jevansaks) and
Vineeth Thomas Alex (vineeththomasalex)
as code owners
November 9, 2026 08:52
Author
|
@microsoft-github-policy-service agree |
Member
|
Thanks Perdixky for the contribution! I've been working to roll back these hand-authored things that are outside the headers. I'll take a look at the toolchain and figure out why these things aren't being scraped out of the headers. |
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
MI function table members are currently emitted as
IntPtr, so projections expose addresses rather than callable signatures. For example,MI_ApplicationFT.NewSessionbecomesisizein Zig.Add named unmanaged delegates in
manual/Mi.csand map the anonymous members to them inemitter.settings.rsp. This covers all 172 anonymous function pointers in 19 MI function tables, both session callbacks, and six nested operation callback parameters. Four additional delegates preserve the session close completion callback, prompt/error responses, and result acknowledgements. Preserve the native calling convention, primitive widths, const annotations, parameter directions, optional parameters and expressible buffer counts.New delegate names follow the existing
MI_ProviderFT_*convention:<struct>_<field>. Nested completion/response/acknowledgement callbacks receive explicit helper delegate names; these names are introduced by this patch, while their signatures come frommi.h.Fixes #842.
Validation:
mi.hand emit baseline/patched MI-only WinMD with the real upstream emitter: passed.mi.hon Windows x86, x64 and ARM64: passed.Validation ran on Linux. The focused scraper harness disables the Linux-only UnixTypes option to match Windows character widths, and uses Zig's MinGW support headers with the repository's unchanged
mi.h. The tests share the exact upstream MiTests.cs, with only the Windows-specific fixture path supplied by a temporary harness. For the pinned 42.0.39 Zig generator, the fixture adapts the metadata attribute namespace rename and overlays only the 26 modified existing MI types and 178 new delegates onto its baseline metadata text. No MI signature is rewritten for Zig. The full Windows SDK crossarch build and live Windows MI execution remain for Windows CI/runtime validation.Header-only inline convenience functions are outside this change; clients can call the typed function tables directly.