// "Why," you may ask, "is it that I'm using the same P/Invokes for UnsafePointer and UnsafeMutablePointer?" // Because it's just pointer arithmetic. The difference between them is that UnsafeMutablePointer has set methods. // The actual representation is identical: a pointer public UnsafePointer <T> Advance(nint by) { var retval = new UnsafePointer <T> (); unsafe { fixed(byte *ptr = SwiftData) { var actualPtr = Marshal.ReadIntPtr(new IntPtr(ptr)); fixed(byte *retvalPtr = StructMarshal.Marshaler.PrepareNominal(retval)) { NativeMethodsForUnsafeMutablePointer.Advance(new IntPtr(retvalPtr), actualPtr, by, StructMarshal.Marshaler.Metatypeof(typeof(T))); } } } return(retval); }
public UnsafePointer(UnsafePointer <T> ptr) : this(ptr.ToIntPtr()) { }
public static OpaquePointer FromUnsafePointer <T> (UnsafePointer <T> ptr) { return(new OpaquePointer(ptr.ToIntPtr())); }