Skip to content

Comments

Add WinRT array support for windows-rdl#3904

Merged
kennykerr merged 3 commits intomasterfrom
rdl-array
Feb 25, 2026
Merged

Add WinRT array support for windows-rdl#3904
kennykerr merged 3 commits intomasterfrom
rdl-array

Conversation

@kennykerr
Copy link
Collaborator

@kennykerr kennykerr commented Feb 24, 2026

Building on #3861 and #3902, this update adds support for WinRT-style array parameters. WinRT defines three kinds of array parameters. There's the input parameter, which acts like a slice (or a view in C++). There's the output parameter, which is allocated by the callee - using CoTaskMemAlloc - and freed by the caller. And there's the return value, which is likewise allocated by the callee and freed by the caller in the same way. Here's an example:

#[winrt]
mod Test {
    interface ITest {
        fn Return(&self, input: [i32]) -> [i32];
        fn Out(&self, input: [i32], output: &mut [i32]);
    }
}

And here's the ECMA-335 representation:

.class interface public auto ansi abstract windowsruntime Test.ITest
{
	.method public hidebysig newslot abstract virtual 
		instance int32[] Return (
			[in] int32[] input
		) cil managed 
	{
	}
	.method public hidebysig newslot abstract virtual 
		instance void Out (
			[in] int32[] input,
			[out] int32[]& output
		) cil managed 
	{
	}
}

Win32 offers a different set of array primitives. I'll deal with those separately.

@kennykerr kennykerr merged commit d7bbc6a into master Feb 25, 2026
32 checks passed
@kennykerr kennykerr deleted the rdl-array branch February 25, 2026 00:05
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.

2 participants