static void OverrideRead(GLib.GType gtype, ReadNativeDelegate callback) { unsafe { IntPtr *raw_ptr = (IntPtr *)(((long)gtype.GetClassPtr()) + (long)class_abi.GetFieldOffset("read")); *raw_ptr = Marshal.GetFunctionPointerForDelegate((Delegate)callback); } }
private uint InternalRead(IntPtr data, uint length, ulong timestamp) { ReadNativeDelegate unmanaged = null; unsafe { IntPtr *raw_ptr = (IntPtr *)(((long)this.LookupGType().GetThresholdType().GetClassPtr()) + (long)class_abi.GetFieldOffset("read")); unmanaged = (ReadNativeDelegate)Marshal.GetDelegateForFunctionPointer(*raw_ptr, typeof(ReadNativeDelegate)); } if (unmanaged == null) { return(0); } uint __result = unmanaged(this.Handle, data, length, timestamp); return(__result); }