Merge pull request #279 from kant2002/kant/nativeaot-offsetof

Make usage of Marshal.OffsetOf AOT friendly
This commit is contained in:
lytico 2021-08-19 17:10:28 +02:00 committed by GitHub
commit 7c50805064
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 9 additions and 9 deletions

View file

@ -18,7 +18,7 @@ namespace GLib {
, (uint) sizeof (ulong) // seq_id
, null
, "hook_size"
, (long) Marshal.OffsetOf(typeof(GHookList_seq_idAlign), "seq_id")
, (long) Marshal.OffsetOf<GHookList_seq_idAlign>("seq_id")
, 0
),
new GLib.AbiField("hook_size"
@ -42,7 +42,7 @@ namespace GLib {
, (uint) sizeof (IntPtr) // hooks
, "is_setup"
, "dummy3"
, (long) Marshal.OffsetOf(typeof(GHookList_hooksAlign), "hooks")
, (long) Marshal.OffsetOf<GHookList_hooksAlign>("hooks")
, 0
),
new GLib.AbiField("dummy3"
@ -50,7 +50,7 @@ namespace GLib {
, (uint) sizeof (IntPtr) // dummy3
, "hooks"
, "finalize_hook"
, (long) Marshal.OffsetOf(typeof(GHookList_dummy3Align), "dummy3")
, (long) Marshal.OffsetOf<GHookList_dummy3Align>("dummy3")
, 0
),
new GLib.AbiField("finalize_hook"
@ -58,7 +58,7 @@ namespace GLib {
, (uint) sizeof (IntPtr) // finalize_hook
, "dummy3"
, "dummy"
, (long) Marshal.OffsetOf(typeof(GHookList_finalize_hookAlign), "finalize_hook")
, (long) Marshal.OffsetOf<GHookList_finalize_hookAlign>("finalize_hook")
, 0
),
new GLib.AbiField("dummy"
@ -66,7 +66,7 @@ namespace GLib {
, (uint) sizeof (IntPtr) * 2 // dummy
, "finalize_hook"
, null
, (long) Marshal.OffsetOf(typeof(GHookList_dummyAlign), "dummy")
, (long) Marshal.OffsetOf<GHookList_dummyAlign>("dummy")
, 0
)
}

View file

@ -942,7 +942,7 @@ namespace GLib {
, (uint) sizeof (IntPtr) // g_type_instance
, null
, "ref_count"
, (long) Marshal.OffsetOf(typeof(GObject_g_type_instanceAlign), "g_type_instance")
, (long) Marshal.OffsetOf<GObject_g_type_instanceAlign>("g_type_instance")
, 0
),
new GLib.AbiField("ref_count"
@ -950,7 +950,7 @@ namespace GLib {
, (uint) sizeof (uint) // ref_count
, "g_type_instance"
, "qdata"
, (long) Marshal.OffsetOf(typeof(GObject_ref_countAlign), "ref_count")
, (long) Marshal.OffsetOf<GObject_ref_countAlign>("ref_count")
, 0
),
new GLib.AbiField("qdata"
@ -958,7 +958,7 @@ namespace GLib {
, (uint) sizeof (IntPtr) // qdata
, "ref_count"
, null
, (long) Marshal.OffsetOf(typeof(GObject_qdataAlign), "qdata")
, (long) Marshal.OffsetOf<GObject_qdataAlign>("qdata")
, 0
),
}

View file

@ -122,7 +122,7 @@ namespace GtkSharp.Generation {
var fieldname = SymbolTable.Table.MangleName (CName).Replace(".", "_");
if (IsArray && IsNullTermArray)
fieldname += "Ptr";
sw.WriteLine(indent + ", (long) Marshal.OffsetOf(typeof(" + alig_struct_name + "), \"" + fieldname + "\")");
sw.WriteLine(indent + ", (long) Marshal.OffsetOf<" + alig_struct_name + ">(\"" + fieldname + "\")");
} else {
sw.WriteLine(indent + ", " + min_align);
}