no more submodule

This commit is contained in:
2024-09-15 22:40:48 +02:00
parent df3b8a3135
commit 0234b33671
5804 changed files with 943618 additions and 1 deletions

View File

@@ -0,0 +1,28 @@
using System;
using System.Runtime.InteropServices;
namespace GLib
{
public static class AbiStructExtension
{
public static N BaseOverride<N>(this AbiStruct class_abi, GType gtype, string fieldname) where N : Delegate
{
N unmanaged = null;
unsafe {
IntPtr raw_ptr = IntPtr.Zero;
while (raw_ptr == IntPtr.Zero && GType.IsManaged(gtype)) {
gtype = gtype.GetThresholdType();
var abi_ptr = (IntPtr*) (((long) gtype.GetClassPtr()) + (long) class_abi.GetFieldOffset(fieldname));
raw_ptr = *abi_ptr;
}
if (raw_ptr != IntPtr.Zero) {
unmanaged = Marshal.GetDelegateForFunctionPointer<N>(raw_ptr);
}
}
return unmanaged;
}
}
}