-
Notifications
You must be signed in to change notification settings - Fork 5.3k
Support strictly blittable type marshalling #69100
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
Support strictly blittable type marshalling #69100
Conversation
|
Tagging subscribers to this area: @dotnet/interop-contrib Issue DetailsThis eases consumption of the
This will permit marshalling of the following: public struct S
{
public short A;
public short B;
}
[CustomTypeMarshaller(typeof(S))]
public struct Native
{
private short a;
private short b;
public Native(S s) { ... }
public S ToManaged() { ... }
}Fixes #69033 /cc @dotnet/interop-contrib
|
|
The existing behavior is documented in https://github.com/dotnet/runtime/blob/main/docs/design/libraries/LibraryImportGenerator/StructMarshalling.md#design-2-disableruntimemarshallingattribute . Are we keeping this design doc up-to-date? |
Yep. This was simply to get feedback first. I thought had marked it "Draft". I do have one more test to add and will update doc once that passes. |
docs/design/libraries/LibraryImportGenerator/StructMarshalling.md
Outdated
Show resolved
Hide resolved
docs/design/libraries/LibraryImportGenerator/StructMarshalling.md
Outdated
Show resolved
Hide resolved
...ystem.Runtime.InteropServices/gen/Microsoft.Interop.SourceGeneration/TypeSymbolExtensions.cs
Show resolved
Hide resolved
docs/design/libraries/LibraryImportGenerator/StructMarshalling.md
Outdated
Show resolved
Hide resolved
Add test to validate check for blittability for assembly reference
|
Failing leg is unrelated, Docker pull failure. |
This eases consumption of the
LibraryImportsource generator by not forcing the use ofDisableRuntimeMarshallingfor types where we can determine the type is blittable based on the following rules:intordouble, but notchar).This will permit marshalling of the following:
Fixes #69033
/cc @dotnet/interop-contrib