Skip to content

mono: Implement support for generic unmanaged calli #98819

@hez2010

Description

@hez2010

As per #97079 (comment)
We have implemented support for generic unmanaged calli in both CoreCLR and NativeAOT. We should also implement it for mono.

Work items:

  • Support generic unmanaged calli for blittable types
  • Enabling generic unmanaged calli can technically enable generic varargs as well, make sure to block generic varargs usage ( in CoreCLR we throw a NotSupportedException).

Optional:

  • Add an error mode to throw MarshalDirectiveException for runtime marshaling (i.e. generic unmanaged calli with non-blittable types). Note that NativeAOT doesn't verify this and will simply produce bad codegen.

After the implementation, we will also need to re-enable tests for generic calli in src/tests/Interop/Interop.csproj.

And we are skipping tests on mono, make sure to enable them as well: https://github.com/dotnet/runtime/blob/main/src%2Ftests%2FInterop%2FMarshalAPI%2FFunctionPointer%2FGenericFunctionPointer.cs#L11-L12

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions