chkn / Xamarin.SwiftUI

.NET bindings for SwiftUI
MIT License
98 stars 7 forks source link

Adopt `LayoutKind.Explicit` for opaque structures #53

Open chkn opened 2 years ago

chkn commented 2 years ago

Previously, CoreCLR did not support explicit layout for structs on non-Windows platforms. To work around it, we ended up adding a bunch of dummy fields, such as this one, to make opaque structs the right size.

Now that explicit layout is supported, we should remove those dummy fields and pass LayoutKind.Explicit and the Size to the StructLayout attribute.