Skip to content

Commit

Permalink
Merge pull request #507 from filipnavara/callback-call-conv
Browse files Browse the repository at this point in the history
Explicitly specify calling convention for UnmanagedCallersOnly
  • Loading branch information
ericsink authored Aug 20, 2022
2 parents ce7f094 + 2c29e6e commit 474666a
Showing 1 changed file with 15 additions and 14 deletions.
29 changes: 15 additions & 14 deletions src/providers/provider.tt
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -221,7 +222,7 @@ namespace SQLitePCL
{
if (FEATURE_FUNCPTRS == "FEATURE_FUNCPTRS/true")
{
return "[UnmanagedCallersOnly]";
return $"[UnmanagedCallersOnly (CallConvs = new[] {{ typeof(CallConv{CONV}) }})]";
}
else
{
Expand All @@ -248,31 +249,31 @@ namespace SQLitePCL
switch (cb)
{
case "exec":
return "delegate* unmanaged <IntPtr, int, IntPtr, IntPtr, int>";
return $"delegate* unmanaged[{CONV}] <IntPtr, int, IntPtr, IntPtr, int>";
case "commit":
return "delegate* unmanaged <IntPtr, int>";
return $"delegate* unmanaged[{CONV}] <IntPtr, int>";
case "scalar_function":
return "delegate* unmanaged <IntPtr, int, IntPtr, void>";
return $"delegate* unmanaged[{CONV}] <IntPtr, int, IntPtr, void>";
case "agg_function_step":
return "delegate* unmanaged <IntPtr, int, IntPtr, void>";
return $"delegate* unmanaged[{CONV}] <IntPtr, int, IntPtr, void>";
case "agg_function_final":
return "delegate* unmanaged <IntPtr, void>";
return $"delegate* unmanaged[{CONV}] <IntPtr, void>";
case "log":
return "delegate* unmanaged <IntPtr, int, IntPtr, void>";
return $"delegate* unmanaged[{CONV}] <IntPtr, int, IntPtr, void>";
case "collation":
return "delegate* unmanaged <IntPtr, int, IntPtr, int, IntPtr, int>";
return $"delegate* unmanaged[{CONV}] <IntPtr, int, IntPtr, int, IntPtr, int>";
case "rollback":
return "delegate* unmanaged <IntPtr, void>";
return $"delegate* unmanaged[{CONV}] <IntPtr, void>";
case "update":
return "delegate* unmanaged <IntPtr, int, IntPtr, IntPtr, Int64, void>";
return $"delegate* unmanaged[{CONV}] <IntPtr, int, IntPtr, IntPtr, Int64, void>";
case "trace":
return "delegate* unmanaged <IntPtr, IntPtr, void>";
return $"delegate* unmanaged[{CONV}] <IntPtr, IntPtr, void>";
case "profile":
return "delegate* unmanaged <IntPtr, IntPtr, long, void>";
return $"delegate* unmanaged[{CONV}] <IntPtr, IntPtr, long, void>";
case "progress_handler":
return "delegate* unmanaged <IntPtr, int>";
return $"delegate* unmanaged[{CONV}] <IntPtr, int>";
case "authorizer":
return "delegate* unmanaged <IntPtr, int, IntPtr, IntPtr, IntPtr, IntPtr, int>";
return $"delegate* unmanaged[{CONV}] <IntPtr, int, IntPtr, IntPtr, IntPtr, IntPtr, int>";
default:
throw new NotImplementedException();
}
Expand Down

0 comments on commit 474666a

Please sign in to comment.