-
Notifications
You must be signed in to change notification settings - Fork 125
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
generation/WinSDK/manual/Backup.cs
could be removed
#1474
Comments
Without this, metadata generates a struct that appears as such: public partial struct ACTIVATION_CONTEXT_COMPATIBILITY_INFORMATION
{
[NativeTypeName("DWORD")]
public uint ElementCount;
[NativeTypeName("COMPATIBILITY_CONTEXT_ELEMENT[]")]
public _Elements_e__FixedBuffer Elements;
public partial struct _Elements_e__FixedBuffer
{
public COMPATIBILITY_CONTEXT_ELEMENT* e0;
public unsafe ref COMPATIBILITY_CONTEXT_ELEMENT* this[int index]
{
get
{
fixed (COMPATIBILITY_CONTEXT_ELEMENT** pThis = &e0)
{
return ref pThis[index];
}
}
}
}
} This fails compilation with cc: @tannergooding |
I pushed the scrape headers task to ClangSharp 15.0.2 and saw no difference. |
@riverar could you share what options the codegen is being generated with? TerraFX also uses ClangSharp and it is being generated correctly there: https://source.terrafx.dev/#TerraFX.Interop.Windows/Windows/um/winnt/ACTIVATION_CONTEXT_COMPATIBILITY_INFORMATION.cs,001635dc53802eb8 (actual source is here: https://github.com/terrafx/terrafx.interop.windows/blob/main/sources/Interop/Windows/Windows/um/winnt/ACTIVATION_CONTEXT_COMPATIBILITY_INFORMATION.cs) There is also correspondingly a test covering this for the "Windows compatible codegen" that I believe microsoft/win32metadata is using: https://github.com/dotnet/ClangSharp/blob/main/tests/ClangSharp.PInvokeGenerator.UnitTests/CSharpCompatibleWindows/StructDeclarationTest.cs#L13-L32 It's notably covering primitive types, but at a glance I don't see any difference for other struct types. |
@tannergooding Here's the base set of options
|
Looks like a post-processing artifact of the I just tested with a
And the command line That generates one file public partial struct _ACTIVATION_CONTEXT_COMPATIBILITY_INFORMATION
{
[NativeTypeName("DWORD")]
public uint ElementCount;
[NativeTypeName("COMPATIBILITY_CONTEXT_ELEMENT[]")]
public _Elements_e__FixedBuffer Elements;
public partial struct _Elements_e__FixedBuffer
{
public _COMPATIBILITY_CONTEXT_ELEMENT e0;
public unsafe ref _COMPATIBILITY_CONTEXT_ELEMENT this[int index]
{
get
{
fixed (_COMPATIBILITY_CONTEXT_ELEMENT* pThis = &e0)
{
return ref pThis[index];
}
}
}
}
} |
@tannergooding Note the struct you pasted is missing |
@riverar, yes. It also contains no unsafe code. Note that the two fields are The This struct in general is not exactly representable in C#/.NET since we don't have a concept of "incomplete arrays" or "zero length" arrays. In C/C++, But when there is a non-zero amount of |
Ah I missed that inner |
The below remap is changing
Do we just need to remove this? |
I've got win32metadata generating the same definition now as @tannergooding. Is that what we want here? |
Should be. ClangSharp was doing the right thing, ABI wise. Not aware of any actual bugs here. |
dotnet/ClangSharp#366 is closed so it appears this file could be removed.
win32metadata/generation/WinSDK/manual/Backup.cs
Lines 5 to 7 in 56ad3d0
The text was updated successfully, but these errors were encountered: