@@ -38,6 +38,41 @@ public SwiftSelf(void* value)
38
38
public void * Value { get ; }
39
39
}
40
40
41
+ /// <summary>
42
+ /// Represents the Swift 'self' context when the argument is Swift frozen struct T, which is either enregistered into multiple registers,
43
+ /// or passed by reference in the 'self' register.
44
+ /// </summary>
45
+ /// <remarks>
46
+ /// <para>
47
+ /// This struct is used to pass the Swift frozen struct T to Swift functions in the context of interop with .NET.
48
+ /// </para>
49
+ /// <para>
50
+ /// Here's an example of how a SwiftSelf<T> context can be declared:
51
+ /// <code lang="csharp">
52
+ /// [UnmanagedCallConv(CallConvs = [typeof(CallConvSwift)])]
53
+ /// [LibraryImport("SwiftLibrary", EntryPoint = "export")]
54
+ /// public static extern void swiftFunction(SwiftSelf<T> self);
55
+ /// </code>
56
+ /// </para>
57
+ /// </remarks>
58
+ [ Intrinsic ]
59
+ public readonly unsafe struct SwiftSelf < T > where T : unmanaged
60
+ {
61
+ /// <summary>
62
+ /// Creates a new instance of the SwiftSelf struct with the specified value.
63
+ /// </summary>
64
+ /// <param name="value">The value representing the self context.</param>
65
+ public SwiftSelf ( T value )
66
+ {
67
+ Value = value ;
68
+ }
69
+
70
+ /// <summary>
71
+ /// Gets the value representing the Swift frozen struct.
72
+ /// </summary>
73
+ public T Value { get ; }
74
+ }
75
+
41
76
/// <summary>
42
77
/// Represents the Swift error context, indicating that the argument is the error context.
43
78
/// </summary>
@@ -71,4 +106,40 @@ public SwiftError(void* value)
71
106
/// </summary>
72
107
public void * Value { get ; }
73
108
}
109
+
110
+ /// <summary>
111
+ /// Represents the Swift return buffer context.
112
+ /// </summary>
113
+ /// <remarks>
114
+ /// <para>
115
+ /// This struct is used to access the return buffer when interoping with Swift functions that return non-frozen structs.
116
+ /// It provides a pointer to the memory location where the result should be stored.
117
+ /// </para>
118
+ /// <para>
119
+ /// Here's an example of how a SwiftIndirectResult can be declared:
120
+ /// <code lang="csharp">
121
+ /// [UnmanagedCallConv(CallConvs = [typeof(CallConvSwift)])]
122
+ /// [LibraryImport("SwiftLibrary", EntryPoint = "export")]
123
+ /// public static extern void swiftFunction(SwiftIndirectResult result);
124
+ /// </code>
125
+ /// </para>
126
+ /// </remarks>
127
+ [ CLSCompliant ( false ) ]
128
+ [ Intrinsic ]
129
+ public readonly unsafe struct SwiftIndirectResult
130
+ {
131
+ /// <summary>
132
+ /// Creates a new instance of the SwiftIndirectResult struct with the specified pointer value.
133
+ /// </summary>
134
+ /// <param name="value">The pointer value representing return buffer context.</param>
135
+ public SwiftIndirectResult ( void * value )
136
+ {
137
+ Value = value ;
138
+ }
139
+
140
+ /// <summary>
141
+ /// Gets the pointer of the return buffer register.
142
+ /// </summary>
143
+ public void * Value { get ; }
144
+ }
74
145
}
0 commit comments