static void OverridePrintLiteral(GLib.GType gtype, PrintLiteralNativeDelegate callback)
 {
     unsafe {
         IntPtr *raw_ptr = (IntPtr *)(((long)gtype.GetClassPtr()) + (long)class_abi.GetFieldOffset("print_literal"));
         *raw_ptr = Marshal.GetFunctionPointerForDelegate((Delegate)callback);
     }
 }
Пример #2
0
        private void InternalPrintLiteral(string message)
        {
            PrintLiteralNativeDelegate unmanaged = class_abi.BaseOverride <PrintLiteralNativeDelegate>(this.LookupGType(), "print_literal");

            if (unmanaged == null)
            {
                return;
            }

            IntPtr native_message = GLib.Marshaller.StringToPtrGStrdup(message);

            unmanaged(this.Handle, native_message);
            GLib.Marshaller.Free(native_message);
        }
        private void InternalPrintLiteral(string message)
        {
            PrintLiteralNativeDelegate unmanaged = null;

            unsafe {
                IntPtr *raw_ptr = (IntPtr *)(((long)this.LookupGType().GetThresholdType().GetClassPtr()) + (long)class_abi.GetFieldOffset("print_literal"));
                unmanaged = (PrintLiteralNativeDelegate)Marshal.GetDelegateForFunctionPointer(*raw_ptr, typeof(PrintLiteralNativeDelegate));
            }
            if (unmanaged == null)
            {
                return;
            }

            IntPtr native_message = GLib.Marshaller.StringToPtrGStrdup(message);

            unmanaged(this.Handle, native_message);
            GLib.Marshaller.Free(native_message);
        }
Пример #4
0
		static void OverridePrintLiteral (GLib.GType gtype, PrintLiteralNativeDelegate callback)
		{
			GApplicationCommandLineClass class_iface = GetClassStruct (gtype, false);
			class_iface.PrintLiteral = callback;
			OverrideClassStruct (gtype, class_iface);
		}