You've already forked linux-packaging-mono
Imported Upstream version 5.20.0.180
Former-commit-id: ff953ca879339fe1e1211f7220f563e1342e66cb
This commit is contained in:
parent
0e2d47d1c8
commit
0510252385
@@ -4,6 +4,8 @@
|
||||
|
||||
using System;
|
||||
|
||||
using Pointer = System.Reflection.Pointer;
|
||||
|
||||
public class BringUpTests
|
||||
{
|
||||
const int Pass = 100;
|
||||
@@ -105,6 +107,14 @@ public class BringUpTests
|
||||
return false;
|
||||
}
|
||||
|
||||
{
|
||||
// This will end up being a delegate to a sealed virtual method.
|
||||
ClassWithIFoo t = new ClassWithIFoo("Class");
|
||||
Func<int, string> d = t.DoFoo;
|
||||
if (d(987) != "Class987")
|
||||
return false;
|
||||
}
|
||||
|
||||
Console.WriteLine("OK");
|
||||
return true;
|
||||
}
|
||||
@@ -247,7 +257,10 @@ public class BringUpTests
|
||||
unsafe
|
||||
{
|
||||
GetAndReturnPointerDelegate d = ClassWithPointers.GetAndReturnPointer;
|
||||
if ((IntPtr)d.DynamicInvoke(new object[] { (IntPtr)8 }) != (IntPtr)50)
|
||||
if (Pointer.Unbox(d.DynamicInvoke(new object[] { (IntPtr)8 })) != (void*)50)
|
||||
return false;
|
||||
|
||||
if (Pointer.Unbox(d.DynamicInvoke(new object[] { Pointer.Box((void*)9, typeof(void*)) })) != (void*)51)
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -390,14 +403,14 @@ static class ExtensionClass
|
||||
}
|
||||
}
|
||||
|
||||
unsafe delegate IntPtr GetAndReturnPointerDelegate(void* ptr);
|
||||
unsafe delegate byte* GetAndReturnPointerDelegate(void* ptr);
|
||||
unsafe delegate void PassPointerByRefDelegate(ref void* ptr);
|
||||
|
||||
unsafe static class ClassWithPointers
|
||||
{
|
||||
public static IntPtr GetAndReturnPointer(void* ptr)
|
||||
public static byte* GetAndReturnPointer(void* ptr)
|
||||
{
|
||||
return (IntPtr)((byte*)ptr + 42);
|
||||
return (byte*)ptr + 42;
|
||||
}
|
||||
|
||||
public static void PassPointerByRef(ref void* ptr)
|
||||
|
||||
Reference in New Issue
Block a user