From 9adcbfce7ba69450d3173f2d129a468023279042 Mon Sep 17 00:00:00 2001 From: Eric Sink Date: Fri, 16 Sep 2022 10:57:00 -0500 Subject: [PATCH] new attempt to fix #506. this is the code change from #507, but limited to use on windows platforms, to avoid apparent iOS AOT bug mentioned in #516. --- Directory.Build.props | 6 +- gen_providers/Program.fs | 10 +-- .../SQLitePCLRaw.lib.e_sqlite3.nuspec | 1 - .../provider_e_sqlcipher_funcptrs_win.cs | 53 ++++++------- .../provider_e_sqlite3_funcptrs_win.cs | 53 ++++++------- .../provider_sqlcipher_funcptrs_win.cs | 53 ++++++------- .../provider_sqlite3_funcptrs_win.cs | 53 ++++++------- src/providers/provider.tt | 78 +++++++++++++------ version_stamp/version_stamp.cs | 8 +- 9 files changed, 176 insertions(+), 139 deletions(-) diff --git a/Directory.Build.props b/Directory.Build.props index f2413a29..a0693415 100644 --- a/Directory.Build.props +++ b/Directory.Build.props @@ -4,9 +4,9 @@ Copyright 2014-2022 SourceGear, LLC SourceGear Eric Sink - 2.1.1-pre20220726160216 - 2.1.1.1667 - 2.1.1.1667 + 2.1.2-pre20220916104546 + 2.1.2.1719 + 2.1.2.1719 SQLitePCLRaw is a Portable Class Library (PCL) for low-level (raw) access to SQLite 10.0 false diff --git a/gen_providers/Program.fs b/gen_providers/Program.fs index 2238c431..fd1e4f58 100644 --- a/gen_providers/Program.fs +++ b/gen_providers/Program.fs @@ -40,7 +40,7 @@ let main argv = gen_provider "dynamic_cdecl" null None "Cdecl" "dynamic" "FEATURE_WIN32DIR/true" "FEATURE_FUNCPTRS/false" "FEATURE_KEY/true" "FEATURE_LOADEXTENSION/true" gen_provider "dynamic_stdcall" null None "StdCall" "dynamic" "FEATURE_WIN32DIR/true" "FEATURE_FUNCPTRS/false" "FEATURE_KEY/true" "FEATURE_LOADEXTENSION/true" gen_provider "internal" "__Internal" (Some "legacy") "Cdecl" "dllimport" "FEATURE_WIN32DIR/false" "FEATURE_FUNCPTRS/false" "FEATURE_KEY/true" "FEATURE_LOADEXTENSION/false" - gen_provider "internal" "__Internal" (Some "funcptrs") "Cdecl" "dllimport" "FEATURE_WIN32DIR/false" "FEATURE_FUNCPTRS/true" "FEATURE_KEY/true" "FEATURE_LOADEXTENSION/false" + gen_provider "internal" "__Internal" (Some "funcptrs") "Cdecl" "dllimport" "FEATURE_WIN32DIR/false" "FEATURE_FUNCPTRS/plain" "FEATURE_KEY/true" "FEATURE_LOADEXTENSION/false" // TODO do we need prenet5 and funcptrs versions of this one? gen_provider "winsqlite3" "winsqlite3" None "StdCall" "dllimport" "FEATURE_WIN32DIR/true" "FEATURE_FUNCPTRS/false" "FEATURE_KEY/false" "FEATURE_LOADEXTENSION/false" @@ -58,14 +58,14 @@ let main argv = for s in ["e_sqlite3"; "sqlite3"; ] do gen_provider s s (Some subname_prenet5_win) "Cdecl" "dllimport" "FEATURE_WIN32DIR/true" "FEATURE_FUNCPTRS/false" "FEATURE_KEY/false" "FEATURE_LOADEXTENSION/false" gen_provider s s (Some subname_prenet5_notwin) "Cdecl" "dllimport" "FEATURE_WIN32DIR/false" "FEATURE_FUNCPTRS/false" "FEATURE_KEY/false" "FEATURE_LOADEXTENSION/false" - gen_provider s s (Some subname_funcptrs_win) "Cdecl" "dllimport" "FEATURE_WIN32DIR/true" "FEATURE_FUNCPTRS/true" "FEATURE_KEY/false" "FEATURE_LOADEXTENSION/false" - gen_provider s s (Some subname_funcptrs_notwin) "Cdecl" "dllimport" "FEATURE_WIN32DIR/false" "FEATURE_FUNCPTRS/true" "FEATURE_KEY/false" "FEATURE_LOADEXTENSION/false" + gen_provider s s (Some subname_funcptrs_win) "Cdecl" "dllimport" "FEATURE_WIN32DIR/true" "FEATURE_FUNCPTRS/callingconv" "FEATURE_KEY/false" "FEATURE_LOADEXTENSION/false" + gen_provider s s (Some subname_funcptrs_notwin) "Cdecl" "dllimport" "FEATURE_WIN32DIR/false" "FEATURE_FUNCPTRS/plain" "FEATURE_KEY/false" "FEATURE_LOADEXTENSION/false" for s in ["e_sqlcipher"; "sqlcipher"; ] do gen_provider s s (Some subname_prenet5_win) "Cdecl" "dllimport" "FEATURE_WIN32DIR/true" "FEATURE_FUNCPTRS/false" "FEATURE_KEY/true" "FEATURE_LOADEXTENSION/false" gen_provider s s (Some subname_prenet5_notwin) "Cdecl" "dllimport" "FEATURE_WIN32DIR/false" "FEATURE_FUNCPTRS/false" "FEATURE_KEY/true" "FEATURE_LOADEXTENSION/false" - gen_provider s s (Some subname_funcptrs_win) "Cdecl" "dllimport" "FEATURE_WIN32DIR/true" "FEATURE_FUNCPTRS/true" "FEATURE_KEY/true" "FEATURE_LOADEXTENSION/false" - gen_provider s s (Some subname_funcptrs_notwin) "Cdecl" "dllimport" "FEATURE_WIN32DIR/false" "FEATURE_FUNCPTRS/true" "FEATURE_KEY/true" "FEATURE_LOADEXTENSION/false" + gen_provider s s (Some subname_funcptrs_win) "Cdecl" "dllimport" "FEATURE_WIN32DIR/true" "FEATURE_FUNCPTRS/callingconv" "FEATURE_KEY/true" "FEATURE_LOADEXTENSION/false" + gen_provider s s (Some subname_funcptrs_notwin) "Cdecl" "dllimport" "FEATURE_WIN32DIR/false" "FEATURE_FUNCPTRS/plain" "FEATURE_KEY/true" "FEATURE_LOADEXTENSION/false" 0 // return an integer exit code diff --git a/src/SQLitePCLRaw.lib.e_sqlite3/SQLitePCLRaw.lib.e_sqlite3.nuspec b/src/SQLitePCLRaw.lib.e_sqlite3/SQLitePCLRaw.lib.e_sqlite3.nuspec index 163a4150..06f33b01 100644 --- a/src/SQLitePCLRaw.lib.e_sqlite3/SQLitePCLRaw.lib.e_sqlite3.nuspec +++ b/src/SQLitePCLRaw.lib.e_sqlite3/SQLitePCLRaw.lib.e_sqlite3.nuspec @@ -42,7 +42,6 @@ - diff --git a/src/SQLitePCLRaw.provider.e_sqlcipher/Generated/provider_e_sqlcipher_funcptrs_win.cs b/src/SQLitePCLRaw.provider.e_sqlcipher/Generated/provider_e_sqlcipher_funcptrs_win.cs index 5954a0d2..412d479c 100644 --- a/src/SQLitePCLRaw.provider.e_sqlcipher/Generated/provider_e_sqlcipher_funcptrs_win.cs +++ b/src/SQLitePCLRaw.provider.e_sqlcipher/Generated/provider_e_sqlcipher_funcptrs_win.cs @@ -27,6 +27,7 @@ namespace SQLitePCL { using System; using System.Collections.Generic; + using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Reflection; using System.Text; @@ -154,7 +155,7 @@ void ISQLite3Provider.sqlite3_interrupt(sqlite3 db) NativeMethods.sqlite3_interrupt(db); } - [UnmanagedCallersOnly] + [UnmanagedCallersOnly (CallConvs = new[] { typeof(CallConvCdecl) })] static int exec_hook_bridge_impl(IntPtr p, int n, IntPtr values_ptr, IntPtr names_ptr) { exec_hook_info hi = exec_hook_info.from_ptr(p); @@ -166,7 +167,7 @@ unsafe int ISQLite3Provider.sqlite3_exec(sqlite3 db, utf8z sql, delegate_exec fu { int rc; - delegate* unmanaged cb; + delegate* unmanaged[Cdecl] cb; exec_hook_info hi; if (func != null) { @@ -613,7 +614,7 @@ unsafe int ISQLite3Provider.sqlite3_load_extension(sqlite3 db, utf8z zFile, utf8 // is shared but not portable. It is in the util.cs file which is compiled // into each platform assembly. - [UnmanagedCallersOnly] + [UnmanagedCallersOnly (CallConvs = new[] { typeof(CallConvCdecl) })] static int commit_hook_bridge_impl(IntPtr p) { commit_hook_info hi = commit_hook_info.from_ptr(p); @@ -631,7 +632,7 @@ unsafe void ISQLite3Provider.sqlite3_commit_hook(sqlite3 db, delegate_commit fun info.commit = null; } - delegate* unmanaged cb; + delegate* unmanaged[Cdecl] cb; commit_hook_info hi; if (func != null) { @@ -653,7 +654,7 @@ unsafe void ISQLite3Provider.sqlite3_commit_hook(sqlite3 db, delegate_commit fun // Passing a callback into SQLite is tricky. See comments near commit_hook // implementation in pinvoke/SQLite3Provider.cs - [UnmanagedCallersOnly] + [UnmanagedCallersOnly (CallConvs = new[] { typeof(CallConvCdecl) })] static void scalar_function_hook_bridge_impl(IntPtr context, int num_args, IntPtr argsptr) { IntPtr p = NativeMethods.sqlite3_user_data(context); @@ -673,7 +674,7 @@ unsafe int ISQLite3Provider.sqlite3_create_function(sqlite3 db, byte[] name, int // 1 is SQLITE_UTF8 int arg4 = 1 | flags; - delegate* unmanaged cb; + delegate* unmanaged[Cdecl] cb; function_hook_info hi; if (func != null) { @@ -698,7 +699,7 @@ unsafe int ISQLite3Provider.sqlite3_create_function(sqlite3 db, byte[] name, int static IDisposable disp_log_hook_handle; - [UnmanagedCallersOnly] + [UnmanagedCallersOnly (CallConvs = new[] { typeof(CallConvCdecl) })] static void log_hook_bridge_impl(IntPtr p, int rc, IntPtr s) { log_hook_info hi = log_hook_info.from_ptr(p); @@ -715,7 +716,7 @@ unsafe int ISQLite3Provider.sqlite3_config_log(delegate_log func, object v) disp_log_hook_handle = null; } - delegate* unmanaged cb; + delegate* unmanaged[Cdecl] cb; log_hook_info hi; if (func != null) { @@ -747,7 +748,7 @@ unsafe void ISQLite3Provider.sqlite3_log(int errcode, utf8z s) // Passing a callback into SQLite is tricky. See comments near commit_hook // implementation in pinvoke/SQLite3Provider.cs - [UnmanagedCallersOnly] + [UnmanagedCallersOnly (CallConvs = new[] { typeof(CallConvCdecl) })] static void agg_function_step_hook_bridge_impl(IntPtr context, int num_args, IntPtr argsptr) { IntPtr agg = NativeMethods.sqlite3_aggregate_context(context, 8); @@ -758,7 +759,7 @@ static void agg_function_step_hook_bridge_impl(IntPtr context, int num_args, Int hi.call_step(context, agg, num_args, argsptr); } - [UnmanagedCallersOnly] + [UnmanagedCallersOnly (CallConvs = new[] { typeof(CallConvCdecl) })] static void agg_function_final_hook_bridge_impl(IntPtr context) { IntPtr agg = NativeMethods.sqlite3_aggregate_context(context, 8); @@ -782,8 +783,8 @@ unsafe int ISQLite3Provider.sqlite3_create_function(sqlite3 db, byte[] name, int // 1 is SQLITE_UTF8 int arg4 = 1 | flags; - delegate* unmanaged cb_step; - delegate* unmanaged cb_final; + delegate* unmanaged[Cdecl] cb_step; + delegate* unmanaged[Cdecl] cb_final; function_hook_info hi; if (func_step != null) { @@ -812,7 +813,7 @@ unsafe int ISQLite3Provider.sqlite3_create_function(sqlite3 db, byte[] name, int // Passing a callback into SQLite is tricky. See comments near commit_hook // implementation in pinvoke/SQLite3Provider.cs - [UnmanagedCallersOnly] + [UnmanagedCallersOnly (CallConvs = new[] { typeof(CallConvCdecl) })] static int collation_hook_bridge_impl(IntPtr p, int len1, IntPtr pv1, int len2, IntPtr pv2) { collation_hook_info hi = collation_hook_info.from_ptr(p); @@ -835,7 +836,7 @@ unsafe int ISQLite3Provider.sqlite3_create_collation(sqlite3 db, byte[] name, ob // TODO maybe turn off the hook here, for now } - delegate* unmanaged cb; + delegate* unmanaged[Cdecl] cb; collation_hook_info hi; if (func != null) { @@ -862,7 +863,7 @@ unsafe int ISQLite3Provider.sqlite3_create_collation(sqlite3 db, byte[] name, ob // Passing a callback into SQLite is tricky. See comments near commit_hook // implementation in pinvoke/SQLite3Provider.cs - [UnmanagedCallersOnly] + [UnmanagedCallersOnly (CallConvs = new[] { typeof(CallConvCdecl) })] static void update_hook_bridge_impl(IntPtr p, int typ, IntPtr db, IntPtr tbl, Int64 rowid) { update_hook_info hi = update_hook_info.from_ptr(p); @@ -880,7 +881,7 @@ unsafe void ISQLite3Provider.sqlite3_update_hook(sqlite3 db, delegate_update fun info.update = null; } - delegate* unmanaged cb; + delegate* unmanaged[Cdecl] cb; update_hook_info hi; if (func != null) { @@ -902,7 +903,7 @@ unsafe void ISQLite3Provider.sqlite3_update_hook(sqlite3 db, delegate_update fun // Passing a callback into SQLite is tricky. See comments near commit_hook // implementation in pinvoke/SQLite3Provider.cs - [UnmanagedCallersOnly] + [UnmanagedCallersOnly (CallConvs = new[] { typeof(CallConvCdecl) })] static void rollback_hook_bridge_impl(IntPtr p) { rollback_hook_info hi = rollback_hook_info.from_ptr(p); @@ -920,7 +921,7 @@ unsafe void ISQLite3Provider.sqlite3_rollback_hook(sqlite3 db, delegate_rollback info.rollback = null; } - delegate* unmanaged cb; + delegate* unmanaged[Cdecl] cb; rollback_hook_info hi; if (func != null) { @@ -942,7 +943,7 @@ unsafe void ISQLite3Provider.sqlite3_rollback_hook(sqlite3 db, delegate_rollback // Passing a callback into SQLite is tricky. See comments near commit_hook // implementation in pinvoke/SQLite3Provider.cs - [UnmanagedCallersOnly] + [UnmanagedCallersOnly (CallConvs = new[] { typeof(CallConvCdecl) })] static void trace_hook_bridge_impl(IntPtr p, IntPtr s) { trace_hook_info hi = trace_hook_info.from_ptr(p); @@ -960,7 +961,7 @@ unsafe void ISQLite3Provider.sqlite3_trace(sqlite3 db, delegate_trace func, obje info.trace = null; } - delegate* unmanaged cb; + delegate* unmanaged[Cdecl] cb; trace_hook_info hi; if (func != null) { @@ -982,7 +983,7 @@ unsafe void ISQLite3Provider.sqlite3_trace(sqlite3 db, delegate_trace func, obje // Passing a callback into SQLite is tricky. See comments near commit_hook // implementation in pinvoke/SQLite3Provider.cs - [UnmanagedCallersOnly] + [UnmanagedCallersOnly (CallConvs = new[] { typeof(CallConvCdecl) })] static void profile_hook_bridge_impl(IntPtr p, IntPtr s, long elapsed) { profile_hook_info hi = profile_hook_info.from_ptr(p); @@ -1000,7 +1001,7 @@ unsafe void ISQLite3Provider.sqlite3_profile(sqlite3 db, delegate_profile func, info.profile = null; } - delegate* unmanaged cb; + delegate* unmanaged[Cdecl] cb; profile_hook_info hi; if (func != null) { @@ -1022,7 +1023,7 @@ unsafe void ISQLite3Provider.sqlite3_profile(sqlite3 db, delegate_profile func, // Passing a callback into SQLite is tricky. See comments near commit_hook // implementation in pinvoke/SQLite3Provider.cs - [UnmanagedCallersOnly] + [UnmanagedCallersOnly (CallConvs = new[] { typeof(CallConvCdecl) })] static int progress_handler_hook_bridge_impl(IntPtr p) { progress_hook_info hi = progress_hook_info.from_ptr(p); @@ -1040,7 +1041,7 @@ unsafe void ISQLite3Provider.sqlite3_progress_handler(sqlite3 db, int instructio info.progress = null; } - delegate* unmanaged cb; + delegate* unmanaged[Cdecl] cb; progress_hook_info hi; if (func != null) { @@ -1064,7 +1065,7 @@ unsafe void ISQLite3Provider.sqlite3_progress_handler(sqlite3 db, int instructio // Passing a callback into SQLite is tricky. See comments near commit_hook // implementation in pinvoke/SQLite3Provider.cs - [UnmanagedCallersOnly] + [UnmanagedCallersOnly (CallConvs = new[] { typeof(CallConvCdecl) })] static int authorizer_hook_bridge_impl(IntPtr p, int action_code, IntPtr param0, IntPtr param1, IntPtr dbName, IntPtr inner_most_trigger_or_view) { authorizer_hook_info hi = authorizer_hook_info.from_ptr(p); @@ -1082,7 +1083,7 @@ unsafe int ISQLite3Provider.sqlite3_set_authorizer(sqlite3 db, delegate_authoriz info.authorizer = null; } - delegate* unmanaged cb; + delegate* unmanaged[Cdecl] cb; authorizer_hook_info hi; if (func != null) { diff --git a/src/SQLitePCLRaw.provider.e_sqlite3/Generated/provider_e_sqlite3_funcptrs_win.cs b/src/SQLitePCLRaw.provider.e_sqlite3/Generated/provider_e_sqlite3_funcptrs_win.cs index 197892f2..364df408 100644 --- a/src/SQLitePCLRaw.provider.e_sqlite3/Generated/provider_e_sqlite3_funcptrs_win.cs +++ b/src/SQLitePCLRaw.provider.e_sqlite3/Generated/provider_e_sqlite3_funcptrs_win.cs @@ -27,6 +27,7 @@ namespace SQLitePCL { using System; using System.Collections.Generic; + using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Reflection; using System.Text; @@ -154,7 +155,7 @@ void ISQLite3Provider.sqlite3_interrupt(sqlite3 db) NativeMethods.sqlite3_interrupt(db); } - [UnmanagedCallersOnly] + [UnmanagedCallersOnly (CallConvs = new[] { typeof(CallConvCdecl) })] static int exec_hook_bridge_impl(IntPtr p, int n, IntPtr values_ptr, IntPtr names_ptr) { exec_hook_info hi = exec_hook_info.from_ptr(p); @@ -166,7 +167,7 @@ unsafe int ISQLite3Provider.sqlite3_exec(sqlite3 db, utf8z sql, delegate_exec fu { int rc; - delegate* unmanaged cb; + delegate* unmanaged[Cdecl] cb; exec_hook_info hi; if (func != null) { @@ -601,7 +602,7 @@ unsafe int ISQLite3Provider.sqlite3_load_extension(sqlite3 db, utf8z zFile, utf8 // is shared but not portable. It is in the util.cs file which is compiled // into each platform assembly. - [UnmanagedCallersOnly] + [UnmanagedCallersOnly (CallConvs = new[] { typeof(CallConvCdecl) })] static int commit_hook_bridge_impl(IntPtr p) { commit_hook_info hi = commit_hook_info.from_ptr(p); @@ -619,7 +620,7 @@ unsafe void ISQLite3Provider.sqlite3_commit_hook(sqlite3 db, delegate_commit fun info.commit = null; } - delegate* unmanaged cb; + delegate* unmanaged[Cdecl] cb; commit_hook_info hi; if (func != null) { @@ -641,7 +642,7 @@ unsafe void ISQLite3Provider.sqlite3_commit_hook(sqlite3 db, delegate_commit fun // Passing a callback into SQLite is tricky. See comments near commit_hook // implementation in pinvoke/SQLite3Provider.cs - [UnmanagedCallersOnly] + [UnmanagedCallersOnly (CallConvs = new[] { typeof(CallConvCdecl) })] static void scalar_function_hook_bridge_impl(IntPtr context, int num_args, IntPtr argsptr) { IntPtr p = NativeMethods.sqlite3_user_data(context); @@ -661,7 +662,7 @@ unsafe int ISQLite3Provider.sqlite3_create_function(sqlite3 db, byte[] name, int // 1 is SQLITE_UTF8 int arg4 = 1 | flags; - delegate* unmanaged cb; + delegate* unmanaged[Cdecl] cb; function_hook_info hi; if (func != null) { @@ -686,7 +687,7 @@ unsafe int ISQLite3Provider.sqlite3_create_function(sqlite3 db, byte[] name, int static IDisposable disp_log_hook_handle; - [UnmanagedCallersOnly] + [UnmanagedCallersOnly (CallConvs = new[] { typeof(CallConvCdecl) })] static void log_hook_bridge_impl(IntPtr p, int rc, IntPtr s) { log_hook_info hi = log_hook_info.from_ptr(p); @@ -703,7 +704,7 @@ unsafe int ISQLite3Provider.sqlite3_config_log(delegate_log func, object v) disp_log_hook_handle = null; } - delegate* unmanaged cb; + delegate* unmanaged[Cdecl] cb; log_hook_info hi; if (func != null) { @@ -735,7 +736,7 @@ unsafe void ISQLite3Provider.sqlite3_log(int errcode, utf8z s) // Passing a callback into SQLite is tricky. See comments near commit_hook // implementation in pinvoke/SQLite3Provider.cs - [UnmanagedCallersOnly] + [UnmanagedCallersOnly (CallConvs = new[] { typeof(CallConvCdecl) })] static void agg_function_step_hook_bridge_impl(IntPtr context, int num_args, IntPtr argsptr) { IntPtr agg = NativeMethods.sqlite3_aggregate_context(context, 8); @@ -746,7 +747,7 @@ static void agg_function_step_hook_bridge_impl(IntPtr context, int num_args, Int hi.call_step(context, agg, num_args, argsptr); } - [UnmanagedCallersOnly] + [UnmanagedCallersOnly (CallConvs = new[] { typeof(CallConvCdecl) })] static void agg_function_final_hook_bridge_impl(IntPtr context) { IntPtr agg = NativeMethods.sqlite3_aggregate_context(context, 8); @@ -770,8 +771,8 @@ unsafe int ISQLite3Provider.sqlite3_create_function(sqlite3 db, byte[] name, int // 1 is SQLITE_UTF8 int arg4 = 1 | flags; - delegate* unmanaged cb_step; - delegate* unmanaged cb_final; + delegate* unmanaged[Cdecl] cb_step; + delegate* unmanaged[Cdecl] cb_final; function_hook_info hi; if (func_step != null) { @@ -800,7 +801,7 @@ unsafe int ISQLite3Provider.sqlite3_create_function(sqlite3 db, byte[] name, int // Passing a callback into SQLite is tricky. See comments near commit_hook // implementation in pinvoke/SQLite3Provider.cs - [UnmanagedCallersOnly] + [UnmanagedCallersOnly (CallConvs = new[] { typeof(CallConvCdecl) })] static int collation_hook_bridge_impl(IntPtr p, int len1, IntPtr pv1, int len2, IntPtr pv2) { collation_hook_info hi = collation_hook_info.from_ptr(p); @@ -823,7 +824,7 @@ unsafe int ISQLite3Provider.sqlite3_create_collation(sqlite3 db, byte[] name, ob // TODO maybe turn off the hook here, for now } - delegate* unmanaged cb; + delegate* unmanaged[Cdecl] cb; collation_hook_info hi; if (func != null) { @@ -850,7 +851,7 @@ unsafe int ISQLite3Provider.sqlite3_create_collation(sqlite3 db, byte[] name, ob // Passing a callback into SQLite is tricky. See comments near commit_hook // implementation in pinvoke/SQLite3Provider.cs - [UnmanagedCallersOnly] + [UnmanagedCallersOnly (CallConvs = new[] { typeof(CallConvCdecl) })] static void update_hook_bridge_impl(IntPtr p, int typ, IntPtr db, IntPtr tbl, Int64 rowid) { update_hook_info hi = update_hook_info.from_ptr(p); @@ -868,7 +869,7 @@ unsafe void ISQLite3Provider.sqlite3_update_hook(sqlite3 db, delegate_update fun info.update = null; } - delegate* unmanaged cb; + delegate* unmanaged[Cdecl] cb; update_hook_info hi; if (func != null) { @@ -890,7 +891,7 @@ unsafe void ISQLite3Provider.sqlite3_update_hook(sqlite3 db, delegate_update fun // Passing a callback into SQLite is tricky. See comments near commit_hook // implementation in pinvoke/SQLite3Provider.cs - [UnmanagedCallersOnly] + [UnmanagedCallersOnly (CallConvs = new[] { typeof(CallConvCdecl) })] static void rollback_hook_bridge_impl(IntPtr p) { rollback_hook_info hi = rollback_hook_info.from_ptr(p); @@ -908,7 +909,7 @@ unsafe void ISQLite3Provider.sqlite3_rollback_hook(sqlite3 db, delegate_rollback info.rollback = null; } - delegate* unmanaged cb; + delegate* unmanaged[Cdecl] cb; rollback_hook_info hi; if (func != null) { @@ -930,7 +931,7 @@ unsafe void ISQLite3Provider.sqlite3_rollback_hook(sqlite3 db, delegate_rollback // Passing a callback into SQLite is tricky. See comments near commit_hook // implementation in pinvoke/SQLite3Provider.cs - [UnmanagedCallersOnly] + [UnmanagedCallersOnly (CallConvs = new[] { typeof(CallConvCdecl) })] static void trace_hook_bridge_impl(IntPtr p, IntPtr s) { trace_hook_info hi = trace_hook_info.from_ptr(p); @@ -948,7 +949,7 @@ unsafe void ISQLite3Provider.sqlite3_trace(sqlite3 db, delegate_trace func, obje info.trace = null; } - delegate* unmanaged cb; + delegate* unmanaged[Cdecl] cb; trace_hook_info hi; if (func != null) { @@ -970,7 +971,7 @@ unsafe void ISQLite3Provider.sqlite3_trace(sqlite3 db, delegate_trace func, obje // Passing a callback into SQLite is tricky. See comments near commit_hook // implementation in pinvoke/SQLite3Provider.cs - [UnmanagedCallersOnly] + [UnmanagedCallersOnly (CallConvs = new[] { typeof(CallConvCdecl) })] static void profile_hook_bridge_impl(IntPtr p, IntPtr s, long elapsed) { profile_hook_info hi = profile_hook_info.from_ptr(p); @@ -988,7 +989,7 @@ unsafe void ISQLite3Provider.sqlite3_profile(sqlite3 db, delegate_profile func, info.profile = null; } - delegate* unmanaged cb; + delegate* unmanaged[Cdecl] cb; profile_hook_info hi; if (func != null) { @@ -1010,7 +1011,7 @@ unsafe void ISQLite3Provider.sqlite3_profile(sqlite3 db, delegate_profile func, // Passing a callback into SQLite is tricky. See comments near commit_hook // implementation in pinvoke/SQLite3Provider.cs - [UnmanagedCallersOnly] + [UnmanagedCallersOnly (CallConvs = new[] { typeof(CallConvCdecl) })] static int progress_handler_hook_bridge_impl(IntPtr p) { progress_hook_info hi = progress_hook_info.from_ptr(p); @@ -1028,7 +1029,7 @@ unsafe void ISQLite3Provider.sqlite3_progress_handler(sqlite3 db, int instructio info.progress = null; } - delegate* unmanaged cb; + delegate* unmanaged[Cdecl] cb; progress_hook_info hi; if (func != null) { @@ -1052,7 +1053,7 @@ unsafe void ISQLite3Provider.sqlite3_progress_handler(sqlite3 db, int instructio // Passing a callback into SQLite is tricky. See comments near commit_hook // implementation in pinvoke/SQLite3Provider.cs - [UnmanagedCallersOnly] + [UnmanagedCallersOnly (CallConvs = new[] { typeof(CallConvCdecl) })] static int authorizer_hook_bridge_impl(IntPtr p, int action_code, IntPtr param0, IntPtr param1, IntPtr dbName, IntPtr inner_most_trigger_or_view) { authorizer_hook_info hi = authorizer_hook_info.from_ptr(p); @@ -1070,7 +1071,7 @@ unsafe int ISQLite3Provider.sqlite3_set_authorizer(sqlite3 db, delegate_authoriz info.authorizer = null; } - delegate* unmanaged cb; + delegate* unmanaged[Cdecl] cb; authorizer_hook_info hi; if (func != null) { diff --git a/src/SQLitePCLRaw.provider.sqlcipher/Generated/provider_sqlcipher_funcptrs_win.cs b/src/SQLitePCLRaw.provider.sqlcipher/Generated/provider_sqlcipher_funcptrs_win.cs index d3515bfe..c2bc2df6 100644 --- a/src/SQLitePCLRaw.provider.sqlcipher/Generated/provider_sqlcipher_funcptrs_win.cs +++ b/src/SQLitePCLRaw.provider.sqlcipher/Generated/provider_sqlcipher_funcptrs_win.cs @@ -27,6 +27,7 @@ namespace SQLitePCL { using System; using System.Collections.Generic; + using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Reflection; using System.Text; @@ -154,7 +155,7 @@ void ISQLite3Provider.sqlite3_interrupt(sqlite3 db) NativeMethods.sqlite3_interrupt(db); } - [UnmanagedCallersOnly] + [UnmanagedCallersOnly (CallConvs = new[] { typeof(CallConvCdecl) })] static int exec_hook_bridge_impl(IntPtr p, int n, IntPtr values_ptr, IntPtr names_ptr) { exec_hook_info hi = exec_hook_info.from_ptr(p); @@ -166,7 +167,7 @@ unsafe int ISQLite3Provider.sqlite3_exec(sqlite3 db, utf8z sql, delegate_exec fu { int rc; - delegate* unmanaged cb; + delegate* unmanaged[Cdecl] cb; exec_hook_info hi; if (func != null) { @@ -613,7 +614,7 @@ unsafe int ISQLite3Provider.sqlite3_load_extension(sqlite3 db, utf8z zFile, utf8 // is shared but not portable. It is in the util.cs file which is compiled // into each platform assembly. - [UnmanagedCallersOnly] + [UnmanagedCallersOnly (CallConvs = new[] { typeof(CallConvCdecl) })] static int commit_hook_bridge_impl(IntPtr p) { commit_hook_info hi = commit_hook_info.from_ptr(p); @@ -631,7 +632,7 @@ unsafe void ISQLite3Provider.sqlite3_commit_hook(sqlite3 db, delegate_commit fun info.commit = null; } - delegate* unmanaged cb; + delegate* unmanaged[Cdecl] cb; commit_hook_info hi; if (func != null) { @@ -653,7 +654,7 @@ unsafe void ISQLite3Provider.sqlite3_commit_hook(sqlite3 db, delegate_commit fun // Passing a callback into SQLite is tricky. See comments near commit_hook // implementation in pinvoke/SQLite3Provider.cs - [UnmanagedCallersOnly] + [UnmanagedCallersOnly (CallConvs = new[] { typeof(CallConvCdecl) })] static void scalar_function_hook_bridge_impl(IntPtr context, int num_args, IntPtr argsptr) { IntPtr p = NativeMethods.sqlite3_user_data(context); @@ -673,7 +674,7 @@ unsafe int ISQLite3Provider.sqlite3_create_function(sqlite3 db, byte[] name, int // 1 is SQLITE_UTF8 int arg4 = 1 | flags; - delegate* unmanaged cb; + delegate* unmanaged[Cdecl] cb; function_hook_info hi; if (func != null) { @@ -698,7 +699,7 @@ unsafe int ISQLite3Provider.sqlite3_create_function(sqlite3 db, byte[] name, int static IDisposable disp_log_hook_handle; - [UnmanagedCallersOnly] + [UnmanagedCallersOnly (CallConvs = new[] { typeof(CallConvCdecl) })] static void log_hook_bridge_impl(IntPtr p, int rc, IntPtr s) { log_hook_info hi = log_hook_info.from_ptr(p); @@ -715,7 +716,7 @@ unsafe int ISQLite3Provider.sqlite3_config_log(delegate_log func, object v) disp_log_hook_handle = null; } - delegate* unmanaged cb; + delegate* unmanaged[Cdecl] cb; log_hook_info hi; if (func != null) { @@ -747,7 +748,7 @@ unsafe void ISQLite3Provider.sqlite3_log(int errcode, utf8z s) // Passing a callback into SQLite is tricky. See comments near commit_hook // implementation in pinvoke/SQLite3Provider.cs - [UnmanagedCallersOnly] + [UnmanagedCallersOnly (CallConvs = new[] { typeof(CallConvCdecl) })] static void agg_function_step_hook_bridge_impl(IntPtr context, int num_args, IntPtr argsptr) { IntPtr agg = NativeMethods.sqlite3_aggregate_context(context, 8); @@ -758,7 +759,7 @@ static void agg_function_step_hook_bridge_impl(IntPtr context, int num_args, Int hi.call_step(context, agg, num_args, argsptr); } - [UnmanagedCallersOnly] + [UnmanagedCallersOnly (CallConvs = new[] { typeof(CallConvCdecl) })] static void agg_function_final_hook_bridge_impl(IntPtr context) { IntPtr agg = NativeMethods.sqlite3_aggregate_context(context, 8); @@ -782,8 +783,8 @@ unsafe int ISQLite3Provider.sqlite3_create_function(sqlite3 db, byte[] name, int // 1 is SQLITE_UTF8 int arg4 = 1 | flags; - delegate* unmanaged cb_step; - delegate* unmanaged cb_final; + delegate* unmanaged[Cdecl] cb_step; + delegate* unmanaged[Cdecl] cb_final; function_hook_info hi; if (func_step != null) { @@ -812,7 +813,7 @@ unsafe int ISQLite3Provider.sqlite3_create_function(sqlite3 db, byte[] name, int // Passing a callback into SQLite is tricky. See comments near commit_hook // implementation in pinvoke/SQLite3Provider.cs - [UnmanagedCallersOnly] + [UnmanagedCallersOnly (CallConvs = new[] { typeof(CallConvCdecl) })] static int collation_hook_bridge_impl(IntPtr p, int len1, IntPtr pv1, int len2, IntPtr pv2) { collation_hook_info hi = collation_hook_info.from_ptr(p); @@ -835,7 +836,7 @@ unsafe int ISQLite3Provider.sqlite3_create_collation(sqlite3 db, byte[] name, ob // TODO maybe turn off the hook here, for now } - delegate* unmanaged cb; + delegate* unmanaged[Cdecl] cb; collation_hook_info hi; if (func != null) { @@ -862,7 +863,7 @@ unsafe int ISQLite3Provider.sqlite3_create_collation(sqlite3 db, byte[] name, ob // Passing a callback into SQLite is tricky. See comments near commit_hook // implementation in pinvoke/SQLite3Provider.cs - [UnmanagedCallersOnly] + [UnmanagedCallersOnly (CallConvs = new[] { typeof(CallConvCdecl) })] static void update_hook_bridge_impl(IntPtr p, int typ, IntPtr db, IntPtr tbl, Int64 rowid) { update_hook_info hi = update_hook_info.from_ptr(p); @@ -880,7 +881,7 @@ unsafe void ISQLite3Provider.sqlite3_update_hook(sqlite3 db, delegate_update fun info.update = null; } - delegate* unmanaged cb; + delegate* unmanaged[Cdecl] cb; update_hook_info hi; if (func != null) { @@ -902,7 +903,7 @@ unsafe void ISQLite3Provider.sqlite3_update_hook(sqlite3 db, delegate_update fun // Passing a callback into SQLite is tricky. See comments near commit_hook // implementation in pinvoke/SQLite3Provider.cs - [UnmanagedCallersOnly] + [UnmanagedCallersOnly (CallConvs = new[] { typeof(CallConvCdecl) })] static void rollback_hook_bridge_impl(IntPtr p) { rollback_hook_info hi = rollback_hook_info.from_ptr(p); @@ -920,7 +921,7 @@ unsafe void ISQLite3Provider.sqlite3_rollback_hook(sqlite3 db, delegate_rollback info.rollback = null; } - delegate* unmanaged cb; + delegate* unmanaged[Cdecl] cb; rollback_hook_info hi; if (func != null) { @@ -942,7 +943,7 @@ unsafe void ISQLite3Provider.sqlite3_rollback_hook(sqlite3 db, delegate_rollback // Passing a callback into SQLite is tricky. See comments near commit_hook // implementation in pinvoke/SQLite3Provider.cs - [UnmanagedCallersOnly] + [UnmanagedCallersOnly (CallConvs = new[] { typeof(CallConvCdecl) })] static void trace_hook_bridge_impl(IntPtr p, IntPtr s) { trace_hook_info hi = trace_hook_info.from_ptr(p); @@ -960,7 +961,7 @@ unsafe void ISQLite3Provider.sqlite3_trace(sqlite3 db, delegate_trace func, obje info.trace = null; } - delegate* unmanaged cb; + delegate* unmanaged[Cdecl] cb; trace_hook_info hi; if (func != null) { @@ -982,7 +983,7 @@ unsafe void ISQLite3Provider.sqlite3_trace(sqlite3 db, delegate_trace func, obje // Passing a callback into SQLite is tricky. See comments near commit_hook // implementation in pinvoke/SQLite3Provider.cs - [UnmanagedCallersOnly] + [UnmanagedCallersOnly (CallConvs = new[] { typeof(CallConvCdecl) })] static void profile_hook_bridge_impl(IntPtr p, IntPtr s, long elapsed) { profile_hook_info hi = profile_hook_info.from_ptr(p); @@ -1000,7 +1001,7 @@ unsafe void ISQLite3Provider.sqlite3_profile(sqlite3 db, delegate_profile func, info.profile = null; } - delegate* unmanaged cb; + delegate* unmanaged[Cdecl] cb; profile_hook_info hi; if (func != null) { @@ -1022,7 +1023,7 @@ unsafe void ISQLite3Provider.sqlite3_profile(sqlite3 db, delegate_profile func, // Passing a callback into SQLite is tricky. See comments near commit_hook // implementation in pinvoke/SQLite3Provider.cs - [UnmanagedCallersOnly] + [UnmanagedCallersOnly (CallConvs = new[] { typeof(CallConvCdecl) })] static int progress_handler_hook_bridge_impl(IntPtr p) { progress_hook_info hi = progress_hook_info.from_ptr(p); @@ -1040,7 +1041,7 @@ unsafe void ISQLite3Provider.sqlite3_progress_handler(sqlite3 db, int instructio info.progress = null; } - delegate* unmanaged cb; + delegate* unmanaged[Cdecl] cb; progress_hook_info hi; if (func != null) { @@ -1064,7 +1065,7 @@ unsafe void ISQLite3Provider.sqlite3_progress_handler(sqlite3 db, int instructio // Passing a callback into SQLite is tricky. See comments near commit_hook // implementation in pinvoke/SQLite3Provider.cs - [UnmanagedCallersOnly] + [UnmanagedCallersOnly (CallConvs = new[] { typeof(CallConvCdecl) })] static int authorizer_hook_bridge_impl(IntPtr p, int action_code, IntPtr param0, IntPtr param1, IntPtr dbName, IntPtr inner_most_trigger_or_view) { authorizer_hook_info hi = authorizer_hook_info.from_ptr(p); @@ -1082,7 +1083,7 @@ unsafe int ISQLite3Provider.sqlite3_set_authorizer(sqlite3 db, delegate_authoriz info.authorizer = null; } - delegate* unmanaged cb; + delegate* unmanaged[Cdecl] cb; authorizer_hook_info hi; if (func != null) { diff --git a/src/SQLitePCLRaw.provider.sqlite3/Generated/provider_sqlite3_funcptrs_win.cs b/src/SQLitePCLRaw.provider.sqlite3/Generated/provider_sqlite3_funcptrs_win.cs index f69e520a..9171c7bd 100644 --- a/src/SQLitePCLRaw.provider.sqlite3/Generated/provider_sqlite3_funcptrs_win.cs +++ b/src/SQLitePCLRaw.provider.sqlite3/Generated/provider_sqlite3_funcptrs_win.cs @@ -27,6 +27,7 @@ namespace SQLitePCL { using System; using System.Collections.Generic; + using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Reflection; using System.Text; @@ -154,7 +155,7 @@ void ISQLite3Provider.sqlite3_interrupt(sqlite3 db) NativeMethods.sqlite3_interrupt(db); } - [UnmanagedCallersOnly] + [UnmanagedCallersOnly (CallConvs = new[] { typeof(CallConvCdecl) })] static int exec_hook_bridge_impl(IntPtr p, int n, IntPtr values_ptr, IntPtr names_ptr) { exec_hook_info hi = exec_hook_info.from_ptr(p); @@ -166,7 +167,7 @@ unsafe int ISQLite3Provider.sqlite3_exec(sqlite3 db, utf8z sql, delegate_exec fu { int rc; - delegate* unmanaged cb; + delegate* unmanaged[Cdecl] cb; exec_hook_info hi; if (func != null) { @@ -601,7 +602,7 @@ unsafe int ISQLite3Provider.sqlite3_load_extension(sqlite3 db, utf8z zFile, utf8 // is shared but not portable. It is in the util.cs file which is compiled // into each platform assembly. - [UnmanagedCallersOnly] + [UnmanagedCallersOnly (CallConvs = new[] { typeof(CallConvCdecl) })] static int commit_hook_bridge_impl(IntPtr p) { commit_hook_info hi = commit_hook_info.from_ptr(p); @@ -619,7 +620,7 @@ unsafe void ISQLite3Provider.sqlite3_commit_hook(sqlite3 db, delegate_commit fun info.commit = null; } - delegate* unmanaged cb; + delegate* unmanaged[Cdecl] cb; commit_hook_info hi; if (func != null) { @@ -641,7 +642,7 @@ unsafe void ISQLite3Provider.sqlite3_commit_hook(sqlite3 db, delegate_commit fun // Passing a callback into SQLite is tricky. See comments near commit_hook // implementation in pinvoke/SQLite3Provider.cs - [UnmanagedCallersOnly] + [UnmanagedCallersOnly (CallConvs = new[] { typeof(CallConvCdecl) })] static void scalar_function_hook_bridge_impl(IntPtr context, int num_args, IntPtr argsptr) { IntPtr p = NativeMethods.sqlite3_user_data(context); @@ -661,7 +662,7 @@ unsafe int ISQLite3Provider.sqlite3_create_function(sqlite3 db, byte[] name, int // 1 is SQLITE_UTF8 int arg4 = 1 | flags; - delegate* unmanaged cb; + delegate* unmanaged[Cdecl] cb; function_hook_info hi; if (func != null) { @@ -686,7 +687,7 @@ unsafe int ISQLite3Provider.sqlite3_create_function(sqlite3 db, byte[] name, int static IDisposable disp_log_hook_handle; - [UnmanagedCallersOnly] + [UnmanagedCallersOnly (CallConvs = new[] { typeof(CallConvCdecl) })] static void log_hook_bridge_impl(IntPtr p, int rc, IntPtr s) { log_hook_info hi = log_hook_info.from_ptr(p); @@ -703,7 +704,7 @@ unsafe int ISQLite3Provider.sqlite3_config_log(delegate_log func, object v) disp_log_hook_handle = null; } - delegate* unmanaged cb; + delegate* unmanaged[Cdecl] cb; log_hook_info hi; if (func != null) { @@ -735,7 +736,7 @@ unsafe void ISQLite3Provider.sqlite3_log(int errcode, utf8z s) // Passing a callback into SQLite is tricky. See comments near commit_hook // implementation in pinvoke/SQLite3Provider.cs - [UnmanagedCallersOnly] + [UnmanagedCallersOnly (CallConvs = new[] { typeof(CallConvCdecl) })] static void agg_function_step_hook_bridge_impl(IntPtr context, int num_args, IntPtr argsptr) { IntPtr agg = NativeMethods.sqlite3_aggregate_context(context, 8); @@ -746,7 +747,7 @@ static void agg_function_step_hook_bridge_impl(IntPtr context, int num_args, Int hi.call_step(context, agg, num_args, argsptr); } - [UnmanagedCallersOnly] + [UnmanagedCallersOnly (CallConvs = new[] { typeof(CallConvCdecl) })] static void agg_function_final_hook_bridge_impl(IntPtr context) { IntPtr agg = NativeMethods.sqlite3_aggregate_context(context, 8); @@ -770,8 +771,8 @@ unsafe int ISQLite3Provider.sqlite3_create_function(sqlite3 db, byte[] name, int // 1 is SQLITE_UTF8 int arg4 = 1 | flags; - delegate* unmanaged cb_step; - delegate* unmanaged cb_final; + delegate* unmanaged[Cdecl] cb_step; + delegate* unmanaged[Cdecl] cb_final; function_hook_info hi; if (func_step != null) { @@ -800,7 +801,7 @@ unsafe int ISQLite3Provider.sqlite3_create_function(sqlite3 db, byte[] name, int // Passing a callback into SQLite is tricky. See comments near commit_hook // implementation in pinvoke/SQLite3Provider.cs - [UnmanagedCallersOnly] + [UnmanagedCallersOnly (CallConvs = new[] { typeof(CallConvCdecl) })] static int collation_hook_bridge_impl(IntPtr p, int len1, IntPtr pv1, int len2, IntPtr pv2) { collation_hook_info hi = collation_hook_info.from_ptr(p); @@ -823,7 +824,7 @@ unsafe int ISQLite3Provider.sqlite3_create_collation(sqlite3 db, byte[] name, ob // TODO maybe turn off the hook here, for now } - delegate* unmanaged cb; + delegate* unmanaged[Cdecl] cb; collation_hook_info hi; if (func != null) { @@ -850,7 +851,7 @@ unsafe int ISQLite3Provider.sqlite3_create_collation(sqlite3 db, byte[] name, ob // Passing a callback into SQLite is tricky. See comments near commit_hook // implementation in pinvoke/SQLite3Provider.cs - [UnmanagedCallersOnly] + [UnmanagedCallersOnly (CallConvs = new[] { typeof(CallConvCdecl) })] static void update_hook_bridge_impl(IntPtr p, int typ, IntPtr db, IntPtr tbl, Int64 rowid) { update_hook_info hi = update_hook_info.from_ptr(p); @@ -868,7 +869,7 @@ unsafe void ISQLite3Provider.sqlite3_update_hook(sqlite3 db, delegate_update fun info.update = null; } - delegate* unmanaged cb; + delegate* unmanaged[Cdecl] cb; update_hook_info hi; if (func != null) { @@ -890,7 +891,7 @@ unsafe void ISQLite3Provider.sqlite3_update_hook(sqlite3 db, delegate_update fun // Passing a callback into SQLite is tricky. See comments near commit_hook // implementation in pinvoke/SQLite3Provider.cs - [UnmanagedCallersOnly] + [UnmanagedCallersOnly (CallConvs = new[] { typeof(CallConvCdecl) })] static void rollback_hook_bridge_impl(IntPtr p) { rollback_hook_info hi = rollback_hook_info.from_ptr(p); @@ -908,7 +909,7 @@ unsafe void ISQLite3Provider.sqlite3_rollback_hook(sqlite3 db, delegate_rollback info.rollback = null; } - delegate* unmanaged cb; + delegate* unmanaged[Cdecl] cb; rollback_hook_info hi; if (func != null) { @@ -930,7 +931,7 @@ unsafe void ISQLite3Provider.sqlite3_rollback_hook(sqlite3 db, delegate_rollback // Passing a callback into SQLite is tricky. See comments near commit_hook // implementation in pinvoke/SQLite3Provider.cs - [UnmanagedCallersOnly] + [UnmanagedCallersOnly (CallConvs = new[] { typeof(CallConvCdecl) })] static void trace_hook_bridge_impl(IntPtr p, IntPtr s) { trace_hook_info hi = trace_hook_info.from_ptr(p); @@ -948,7 +949,7 @@ unsafe void ISQLite3Provider.sqlite3_trace(sqlite3 db, delegate_trace func, obje info.trace = null; } - delegate* unmanaged cb; + delegate* unmanaged[Cdecl] cb; trace_hook_info hi; if (func != null) { @@ -970,7 +971,7 @@ unsafe void ISQLite3Provider.sqlite3_trace(sqlite3 db, delegate_trace func, obje // Passing a callback into SQLite is tricky. See comments near commit_hook // implementation in pinvoke/SQLite3Provider.cs - [UnmanagedCallersOnly] + [UnmanagedCallersOnly (CallConvs = new[] { typeof(CallConvCdecl) })] static void profile_hook_bridge_impl(IntPtr p, IntPtr s, long elapsed) { profile_hook_info hi = profile_hook_info.from_ptr(p); @@ -988,7 +989,7 @@ unsafe void ISQLite3Provider.sqlite3_profile(sqlite3 db, delegate_profile func, info.profile = null; } - delegate* unmanaged cb; + delegate* unmanaged[Cdecl] cb; profile_hook_info hi; if (func != null) { @@ -1010,7 +1011,7 @@ unsafe void ISQLite3Provider.sqlite3_profile(sqlite3 db, delegate_profile func, // Passing a callback into SQLite is tricky. See comments near commit_hook // implementation in pinvoke/SQLite3Provider.cs - [UnmanagedCallersOnly] + [UnmanagedCallersOnly (CallConvs = new[] { typeof(CallConvCdecl) })] static int progress_handler_hook_bridge_impl(IntPtr p) { progress_hook_info hi = progress_hook_info.from_ptr(p); @@ -1028,7 +1029,7 @@ unsafe void ISQLite3Provider.sqlite3_progress_handler(sqlite3 db, int instructio info.progress = null; } - delegate* unmanaged cb; + delegate* unmanaged[Cdecl] cb; progress_hook_info hi; if (func != null) { @@ -1052,7 +1053,7 @@ unsafe void ISQLite3Provider.sqlite3_progress_handler(sqlite3 db, int instructio // Passing a callback into SQLite is tricky. See comments near commit_hook // implementation in pinvoke/SQLite3Provider.cs - [UnmanagedCallersOnly] + [UnmanagedCallersOnly (CallConvs = new[] { typeof(CallConvCdecl) })] static int authorizer_hook_bridge_impl(IntPtr p, int action_code, IntPtr param0, IntPtr param1, IntPtr dbName, IntPtr inner_most_trigger_or_view) { authorizer_hook_info hi = authorizer_hook_info.from_ptr(p); @@ -1070,7 +1071,7 @@ unsafe int ISQLite3Provider.sqlite3_set_authorizer(sqlite3 db, delegate_authoriz info.authorizer = null; } - delegate* unmanaged cb; + delegate* unmanaged[Cdecl] cb; authorizer_hook_info hi; if (func != null) { diff --git a/src/providers/provider.tt b/src/providers/provider.tt index a9580fe0..f22fbaf1 100644 --- a/src/providers/provider.tt +++ b/src/providers/provider.tt @@ -44,11 +44,30 @@ { throw new NotImplementedException(); } + if ( + (FEATURE_FUNCPTRS == "FEATURE_FUNCPTRS/false") + || (FEATURE_FUNCPTRS == "FEATURE_FUNCPTRS/callingconv") + || (FEATURE_FUNCPTRS == "FEATURE_FUNCPTRS/plain") + ) + { + } + else + { + throw new NotImplementedException("invalid value for FEATURE_FUNCPTRS"); + } #> namespace SQLitePCL { using System; using System.Collections.Generic; +<# + if (FEATURE_FUNCPTRS == "FEATURE_FUNCPTRS/callingconv") + { +#> + using System.Runtime.CompilerServices; +<# + } +#> using System.Runtime.InteropServices; using System.Reflection; using System.Text; @@ -216,13 +235,17 @@ namespace SQLitePCL // UnmanagedFunctionPointerAttribute with a delegate and MonoPInvokeCallback // to // UnmanagedCallersOnly and C# 9.3 function pointers, requiring .NET 5 min - bool USE_FUNCPTRS = (FEATURE_FUNCPTRS == "FEATURE_FUNCPTRS/true"); + bool USE_FUNCPTRS = (FEATURE_FUNCPTRS != "FEATURE_FUNCPTRS/false"); string get_monopinvokecallback_attr(string cb) { - if (FEATURE_FUNCPTRS == "FEATURE_FUNCPTRS/true") + if (FEATURE_FUNCPTRS == "FEATURE_FUNCPTRS/plain") { return "[UnmanagedCallersOnly]"; } + else if (FEATURE_FUNCPTRS == "FEATURE_FUNCPTRS/callingconv") + { + return $"[UnmanagedCallersOnly (CallConvs = new[] {{ typeof(CallConv{CONV}) }})]"; + } else { return $"[MonoPInvokeCallback (typeof(NativeMethods.callback_{cb}))]"; @@ -231,7 +254,7 @@ namespace SQLitePCL string get_cb_delegate_field(string cb) { - if (FEATURE_FUNCPTRS == "FEATURE_FUNCPTRS/true") + if (FEATURE_FUNCPTRS != "FEATURE_FUNCPTRS/false") { return ""; } @@ -243,36 +266,45 @@ namespace SQLitePCL string get_cb_type(string cb) { - if (FEATURE_FUNCPTRS == "FEATURE_FUNCPTRS/true") + if (FEATURE_FUNCPTRS != "FEATURE_FUNCPTRS/false") { + string callingconv; + if (FEATURE_FUNCPTRS == "FEATURE_FUNCPTRS/callingconv") + { + callingconv = $"[{CONV}]"; + } + else + { + callingconv = ""; + } switch (cb) { case "exec": - return "delegate* unmanaged "; + return $"delegate* unmanaged{callingconv} "; case "commit": - return "delegate* unmanaged "; + return $"delegate* unmanaged{callingconv} "; case "scalar_function": - return "delegate* unmanaged "; + return $"delegate* unmanaged{callingconv} "; case "agg_function_step": - return "delegate* unmanaged "; + return $"delegate* unmanaged{callingconv} "; case "agg_function_final": - return "delegate* unmanaged "; + return $"delegate* unmanaged{callingconv} "; case "log": - return "delegate* unmanaged "; + return $"delegate* unmanaged{callingconv} "; case "collation": - return "delegate* unmanaged "; + return $"delegate* unmanaged{callingconv} "; case "rollback": - return "delegate* unmanaged "; + return $"delegate* unmanaged{callingconv} "; case "update": - return "delegate* unmanaged "; + return $"delegate* unmanaged{callingconv} "; case "trace": - return "delegate* unmanaged "; + return $"delegate* unmanaged{callingconv} "; case "profile": - return "delegate* unmanaged "; + return $"delegate* unmanaged{callingconv} "; case "progress_handler": - return "delegate* unmanaged "; + return $"delegate* unmanaged{callingconv} "; case "authorizer": - return "delegate* unmanaged "; + return $"delegate* unmanaged{callingconv} "; default: throw new NotImplementedException(); } @@ -285,7 +317,7 @@ namespace SQLitePCL string get_cb_val_field(string cb) { - if (FEATURE_FUNCPTRS == "FEATURE_FUNCPTRS/true") + if (FEATURE_FUNCPTRS != "FEATURE_FUNCPTRS/false") { return $"&{cb}_hook_bridge_impl"; } @@ -297,7 +329,7 @@ namespace SQLitePCL string get_cb_val_nofield(string cb) { - if (FEATURE_FUNCPTRS == "FEATURE_FUNCPTRS/true") + if (FEATURE_FUNCPTRS != "FEATURE_FUNCPTRS/false") { return $"&{cb}_hook_bridge_impl"; } @@ -309,7 +341,7 @@ namespace SQLitePCL string get_cb_arg(string cb) { - if (FEATURE_FUNCPTRS == "FEATURE_FUNCPTRS/true") + if (FEATURE_FUNCPTRS != "FEATURE_FUNCPTRS/false") { return $"(IntPtr) {cb}"; } @@ -321,7 +353,7 @@ namespace SQLitePCL string get_cb_null() { - if (FEATURE_FUNCPTRS == "FEATURE_FUNCPTRS/true") + if (FEATURE_FUNCPTRS != "FEATURE_FUNCPTRS/false") { return "IntPtr.Zero"; } @@ -1771,7 +1803,7 @@ namespace SQLitePCL <# write_api_entries(KIND); } - if (FEATURE_FUNCPTRS == "FEATURE_FUNCPTRS/true") + if (FEATURE_FUNCPTRS != "FEATURE_FUNCPTRS/false") { } else @@ -3272,7 +3304,7 @@ namespace SQLitePCL string get_fixed_parm_type(Parm p) { string typ = p.typ; - if (FEATURE_FUNCPTRS == "FEATURE_FUNCPTRS/true") + if (FEATURE_FUNCPTRS != "FEATURE_FUNCPTRS/false") { switch (typ) { diff --git a/version_stamp/version_stamp.cs b/version_stamp/version_stamp.cs index 0ea62895..118779a2 100644 --- a/version_stamp/version_stamp.cs +++ b/version_stamp/version_stamp.cs @@ -50,10 +50,12 @@ public static class gen PATCH_VERSION ); - // keep one of the following 3 - //public static string NUSPEC_VERSION = NUSPEC_VERSION_PRE_TIMESTAMP; + // keep one of the following 2: + public static string NUSPEC_VERSION = NUSPEC_VERSION_PRE_TIMESTAMP; + //public static string NUSPEC_VERSION = NUSPEC_VERSION_RELEASE; + + // or maaaaybe this one, but probably not: //public static string NUSPEC_VERSION = NUSPEC_VERSION_PRE; - public static string NUSPEC_VERSION = NUSPEC_VERSION_RELEASE; public static string ASSEMBLY_VERSION = string.Format("{0}.{1}.{2}.{3}", MAJOR_VERSION,