Skip to content
This repository was archived by the owner on Dec 12, 2024. It is now read-only.

Commit 115c615

Browse files
Merge pull request #830 from xamarin/class-less
fix rt unmanagedcallers
2 parents 59d2970 + ad28218 commit 115c615

File tree

2 files changed

+12
-12
lines changed

2 files changed

+12
-12
lines changed

SwiftRuntimeLibrary/SwiftComparableProxy.cs

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,9 @@ public SwiftComparableProxy (ISwiftExistentialContainer container)
2323

2424
struct Comparable_xam_vtable {
2525
[MarshalAs (UnmanagedType.FunctionPtr)]
26-
public unsafe delegate* unmanaged<IntPtr, IntPtr, bool> opEqualFunc;
26+
public unsafe delegate* unmanaged<IntPtr, IntPtr, int> opEqualFunc;
2727
[MarshalAs (UnmanagedType.FunctionPtr)]
28-
public unsafe delegate* unmanaged<IntPtr, IntPtr, bool> opLessFunc;
28+
public unsafe delegate* unmanaged<IntPtr, IntPtr, int> opLessFunc;
2929
}
3030

3131
static Comparable_xam_vtable vtableIComparable;
@@ -34,24 +34,24 @@ static SwiftComparableProxy ()
3434
XamSetVTable ();
3535
}
3636

37-
[UnmanagedCallersOnly]
38-
static bool EqFunc (IntPtr oneptr, IntPtr twoptr)
37+
[UnmanagedCallersOnly]
38+
static int EqFunc (IntPtr oneptr, IntPtr twoptr)
3939
{
4040
if (oneptr == twoptr)
41-
return true;
41+
return 1;
4242
var one = SwiftObjectRegistry.Registry.ProxyForEveryProtocolHandle<ISwiftComparable> (oneptr);
4343
var two = SwiftObjectRegistry.Registry.ProxyForEveryProtocolHandle<ISwiftComparable> (twoptr);
44-
return one.OpEquals (two);
44+
return one.OpEquals (two) ? 1 : 0;
4545
}
4646

4747
[UnmanagedCallersOnly]
48-
static bool LessFunc (IntPtr oneptr, IntPtr twoptr)
48+
static int LessFunc (IntPtr oneptr, IntPtr twoptr)
4949
{
5050
if (oneptr == twoptr)
51-
return false;
51+
return 0;
5252
var one = SwiftObjectRegistry.Registry.ProxyForEveryProtocolHandle<ISwiftComparable> (oneptr);
5353
var two = SwiftObjectRegistry.Registry.ProxyForEveryProtocolHandle<ISwiftComparable> (twoptr);
54-
return one.OpLess (two);
54+
return one.OpLess (two) ? 1 : 0;
5555
}
5656

5757
static void XamSetVTable ()

SwiftRuntimeLibrary/SwiftEquatableProxy.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ public SwiftEquatableProxy (ISwiftExistentialContainer container)
2222

2323
struct Equatable_xam_vtable {
2424
public delegate bool Delfunc0 (IntPtr one, IntPtr two);
25-
public unsafe delegate *unmanaged<IntPtr, IntPtr, byte> func0;
25+
public unsafe delegate *unmanaged<IntPtr, IntPtr, int> func0;
2626
}
2727

2828
static Equatable_xam_vtable vtableIEquatable;
@@ -32,15 +32,15 @@ static SwiftEquatableProxy ()
3232
}
3333

3434
[UnmanagedCallersOnly]
35-
static byte EqFunc (IntPtr oneptr, IntPtr twoptr)
35+
static int EqFunc (IntPtr oneptr, IntPtr twoptr)
3636
{
3737
if (oneptr == twoptr)
3838
return 1;
3939

4040
var one = SwiftObjectRegistry.Registry.ProxyForEveryProtocolHandle<ISwiftEquatable> (oneptr);
4141
var two = SwiftObjectRegistry.Registry.ProxyForEveryProtocolHandle<ISwiftEquatable> (twoptr);
4242

43-
return one.OpEquals (two) ? (byte)1 : (byte)0;
43+
return one.OpEquals (two) ? 1 : 0;
4444
}
4545

4646
static void XamSetVTable ()

0 commit comments

Comments
 (0)