You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This issue presents test cases for the validation of the SwiftIndirectResult proposal. This proposal is a dependency for the projection tooling to invoke initializers/methods that return non-frozen structs. In C#, these projections shouldn't return reference, but allocate memory and pass it via SwiftIndirectResult.
Test cases for validation
Below are examples of initializers/methods that return non-frozen structs in C#. When the proposal gets approved, the existing runtime tests should be expanded with such test cases.
Example of a Swift non-frozen struct projected into C# from the proposal:
using System;using System.Runtime.InteropServices;using System.Runtime.InteropServices.Swift;publicclassPoint{privatevoid*_payload;privatestaticreadonlyint_payloadSize=/* Metadata information from value witness table */;publicPoint(doublex,doubley){_payload= Marshal.AllocHGlobal(_payloadSize).ToPointer();try{
PIfunc_init(x, y,new SwiftIndirectResult(_payload));}catch{
Marshal.FreeHGlobal(new IntPtr(payload));throw;}}~Point(){if(_payload!=null){
Marshal.FreeHGlobal(_payload);_payload= IntPtr.Zero;}}[UnmanagedCallConv(CallConvs =new Type[]{typeof(CallConvSwift)})][DllImport("libSwiftPoint.dylib", EntryPoint ="PIfunc_init")]privatestaticexternvoidPIfunc_init(doublex,doubley,SwiftIndirectResultpayload);}
Example of a Swift function that returns non-frozen struct projected into C# from the proposal:
Description
This issue presents test cases for the validation of the
SwiftIndirectResult
proposal. This proposal is a dependency for the projection tooling to invoke initializers/methods that return non-frozen structs. In C#, these projections shouldn't return reference, but allocate memory and pass it viaSwiftIndirectResult
.Test cases for validation
Below are examples of initializers/methods that return non-frozen structs in C#. When the proposal gets approved, the existing runtime tests should be expanded with such test cases.
Example of a Swift non-frozen struct projected into C# from the proposal:
Example of a Swift function that returns non-frozen struct projected into C# from the proposal:
The text was updated successfully, but these errors were encountered: