mirror of
https://github.com/Ryujinx/GtkSharp.git
synced 2024-12-22 14:25:39 +00:00
Use Marshal.GetFunctionPointerForDelegate<T> (#301)
This make code more trim friendly Improve #300
This commit is contained in:
parent
afc7ab450b
commit
723fef9d8d
|
@ -32,7 +32,7 @@ namespace Gtk
|
|||
{
|
||||
unsafe {
|
||||
IntPtr* raw_ptr = (IntPtr*) (((long) gtype.GetClassPtr ()) + (long) class_abi.GetFieldOffset ("get_size"));
|
||||
*raw_ptr = Marshal.GetFunctionPointerForDelegate ((Delegate) callback);
|
||||
*raw_ptr = Marshal.GetFunctionPointerForDelegate (callback);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -41,7 +41,7 @@ namespace Gtk
|
|||
{
|
||||
unsafe {
|
||||
IntPtr* raw_ptr = (IntPtr*) (((long) gtype.GetClassPtr()) + (long) class_abi.GetFieldOffset("forall"));
|
||||
*raw_ptr = Marshal.GetFunctionPointerForDelegate((Delegate) callback);
|
||||
*raw_ptr = Marshal.GetFunctionPointerForDelegate(callback);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -176,7 +176,7 @@ namespace GtkSharp.Generation {
|
|||
// Override VM; class_offset var is generated by object generatable
|
||||
sw.WriteLine("\t\t\tunsafe {");
|
||||
sw.WriteLine("\t\t\t\tIntPtr* raw_ptr = (IntPtr*)(((long) gtype.GetClassPtr()) + (long) class_abi.GetFieldOffset(\"{0}\"));", CName);
|
||||
sw.WriteLine("\t\t\t\t*raw_ptr = Marshal.GetFunctionPointerForDelegate((Delegate) callback);");
|
||||
sw.WriteLine("\t\t\t\t*raw_ptr = Marshal.GetFunctionPointerForDelegate(callback);");
|
||||
sw.WriteLine("\t\t\t}");
|
||||
sw.WriteLine("\t\t}");
|
||||
sw.WriteLine ();
|
||||
|
|
Loading…
Reference in a new issue