From 2c29e6ec603d652fc7567df1bed33105fe09e821 Mon Sep 17 00:00:00 2001 From: Filip Navara Date: Fri, 19 Aug 2022 16:11:10 +0200 Subject: [PATCH] Explicitly specify calling convention for UnmanagedCallersOnly --- src/providers/provider.tt | 29 +++++++++++++++-------------- 1 file changed, 15 insertions(+), 14 deletions(-) diff --git a/src/providers/provider.tt b/src/providers/provider.tt index a9580fe0..56f4042f 100644 --- a/src/providers/provider.tt +++ b/src/providers/provider.tt @@ -49,6 +49,7 @@ namespace SQLitePCL { using System; using System.Collections.Generic; + using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Reflection; using System.Text; @@ -221,7 +222,7 @@ namespace SQLitePCL { if (FEATURE_FUNCPTRS == "FEATURE_FUNCPTRS/true") { - return "[UnmanagedCallersOnly]"; + return $"[UnmanagedCallersOnly (CallConvs = new[] {{ typeof(CallConv{CONV}) }})]"; } else { @@ -248,31 +249,31 @@ namespace SQLitePCL switch (cb) { case "exec": - return "delegate* unmanaged "; + return $"delegate* unmanaged[{CONV}] "; case "commit": - return "delegate* unmanaged "; + return $"delegate* unmanaged[{CONV}] "; case "scalar_function": - return "delegate* unmanaged "; + return $"delegate* unmanaged[{CONV}] "; case "agg_function_step": - return "delegate* unmanaged "; + return $"delegate* unmanaged[{CONV}] "; case "agg_function_final": - return "delegate* unmanaged "; + return $"delegate* unmanaged[{CONV}] "; case "log": - return "delegate* unmanaged "; + return $"delegate* unmanaged[{CONV}] "; case "collation": - return "delegate* unmanaged "; + return $"delegate* unmanaged[{CONV}] "; case "rollback": - return "delegate* unmanaged "; + return $"delegate* unmanaged[{CONV}] "; case "update": - return "delegate* unmanaged "; + return $"delegate* unmanaged[{CONV}] "; case "trace": - return "delegate* unmanaged "; + return $"delegate* unmanaged[{CONV}] "; case "profile": - return "delegate* unmanaged "; + return $"delegate* unmanaged[{CONV}] "; case "progress_handler": - return "delegate* unmanaged "; + return $"delegate* unmanaged[{CONV}] "; case "authorizer": - return "delegate* unmanaged "; + return $"delegate* unmanaged[{CONV}] "; default: throw new NotImplementedException(); }