From a0b19faff74d5d6f96e4982b5759b4f75d28b16d Mon Sep 17 00:00:00 2001 From: Eric Sink Date: Fri, 28 Jan 2022 12:25:38 -0600 Subject: [PATCH] rebuild picked up autogen changes to providers from arm64cc change recently. removed earmeabi build of e_sqlcipher. turn off soft_limit64 test for winsqlite3, since it was failing. --- Directory.Build.props | 6 +- ...QLitePCLRaw.lib.e_sqlcipher.android.csproj | 4 -- .../Generated/provider_dynamic_cdecl.cs | 55 ++++++++++++++++++- .../Generated/provider_dynamic_stdcall.cs | 55 ++++++++++++++++++- .../Generated/provider_e_sqlcipher.cs | 40 +++++++++++++- .../Generated/provider_e_sqlcipher.cs | 40 +++++++++++++- .../Generated/provider_e_sqlcipher.cs | 40 +++++++++++++- .../Generated/provider_e_sqlite3.cs | 40 +++++++++++++- .../Generated/provider_e_sqlite3.cs | 40 +++++++++++++- .../Generated/provider_e_sqlite3.cs | 40 +++++++++++++- .../Generated/provider_internal.cs | 40 +++++++++++++- .../Generated/provider_sqlcipher.cs | 40 +++++++++++++- .../Generated/provider_sqlcipher.cs | 40 +++++++++++++- .../Generated/provider_sqlcipher.cs | 40 +++++++++++++- .../Generated/provider_sqlite3.cs | 40 +++++++++++++- .../Generated/provider_sqlite3.cs | 40 +++++++++++++- .../Generated/provider_sqlite3.cs | 40 +++++++++++++- .../Generated/provider_winsqlite3.cs | 40 +++++++++++++- src/common/tests_xunit.cs | 4 ++ 19 files changed, 629 insertions(+), 55 deletions(-) diff --git a/Directory.Build.props b/Directory.Build.props index 5f23bb7e..1f35c24a 100644 --- a/Directory.Build.props +++ b/Directory.Build.props @@ -4,9 +4,9 @@ Copyright 2014-2021 SourceGear, LLC SourceGear Eric Sink - 2.0.8-pre20211122085231 - 2.0.8.1421 - 2.0.8.1421 + 2.0.8-pre20220128122014 + 2.0.8.1488 + 2.0.8.1488 SQLitePCLRaw is a Portable Class Library (PCL) for low-level (raw) access to SQLite 7.3 false diff --git a/src/SQLitePCLRaw.lib.e_sqlcipher.android/SQLitePCLRaw.lib.e_sqlcipher.android.csproj b/src/SQLitePCLRaw.lib.e_sqlcipher.android/SQLitePCLRaw.lib.e_sqlcipher.android.csproj index e84d8c0d..65a322fa 100644 --- a/src/SQLitePCLRaw.lib.e_sqlcipher.android/SQLitePCLRaw.lib.e_sqlcipher.android.csproj +++ b/src/SQLitePCLRaw.lib.e_sqlcipher.android/SQLitePCLRaw.lib.e_sqlcipher.android.csproj @@ -24,10 +24,6 @@ Always x86_64\libe_sqlcipher.so - - Always - armeabi\libe_sqlcipher.so - Always arm64-v8a\libe_sqlcipher.so diff --git a/src/SQLitePCLRaw.provider.dynamic_cdecl/Generated/provider_dynamic_cdecl.cs b/src/SQLitePCLRaw.provider.dynamic_cdecl/Generated/provider_dynamic_cdecl.cs index 465bda36..756cc6dc 100644 --- a/src/SQLitePCLRaw.provider.dynamic_cdecl/Generated/provider_dynamic_cdecl.cs +++ b/src/SQLitePCLRaw.provider.dynamic_cdecl/Generated/provider_dynamic_cdecl.cs @@ -36,6 +36,10 @@ public sealed class SQLite3Provider_dynamic_cdecl : ISQLite3Provider { const CallingConvention CALLING_CONVENTION = CallingConvention.Cdecl; + static readonly bool IsArm64cc = + RuntimeInformation.ProcessArchitecture == Architecture.Arm64 && + (RuntimeInformation.IsOSPlatform(OSPlatform.OSX) || RuntimeInformation.IsOSPlatform(OSPlatform.Create("IOS"))); + private static string _native_library_name; public static void Setup(string name, IGetFunctionPointer gf) { @@ -530,6 +534,9 @@ int ISQLite3Provider.sqlite3_config(int op) int ISQLite3Provider.sqlite3_config(int op, int val) { + if (IsArm64cc) + return NativeMethods.sqlite3_config_int_arm64cc(op, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero, val); + return NativeMethods.sqlite3_config_int(op, val); } @@ -537,6 +544,9 @@ unsafe int ISQLite3Provider.sqlite3_db_config(sqlite3 db, int op, utf8z val) { fixed (byte* p_val = val) { + if (IsArm64cc) + return NativeMethods.sqlite3_db_config_charptr_arm64cc(db, op, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero, p_val); + return NativeMethods.sqlite3_db_config_charptr(db, op, p_val); } } @@ -544,7 +554,12 @@ unsafe int ISQLite3Provider.sqlite3_db_config(sqlite3 db, int op, utf8z val) unsafe int ISQLite3Provider.sqlite3_db_config(sqlite3 db, int op, int val, out int result) { int out_result = 0; - int native_result = NativeMethods.sqlite3_db_config_int_outint(db, op, val, &out_result); + int native_result; + + if (IsArm64cc) + native_result = NativeMethods.sqlite3_db_config_int_outint_arm64cc(db, op, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero, val, &out_result); + else + native_result = NativeMethods.sqlite3_db_config_int_outint(db, op, val, &out_result); result = out_result; @@ -553,6 +568,9 @@ unsafe int ISQLite3Provider.sqlite3_db_config(sqlite3 db, int op, int val, out i int ISQLite3Provider.sqlite3_db_config(sqlite3 db, int op, IntPtr ptr, int int0, int int1) { + if (IsArm64cc) + return NativeMethods.sqlite3_db_config_intptr_int_int_arm64cc(db, op, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero, ptr, int0, int1); + return NativeMethods.sqlite3_db_config_intptr_int_int(db, op, ptr, int0, int1); } @@ -710,8 +728,9 @@ int ISQLite3Provider.sqlite3_config_log(delegate_log func, object v) } var h = new hook_handle(hi); disp_log_hook_handle = h; // TODO if valid - var rc = NativeMethods.sqlite3_config_log(raw.SQLITE_CONFIG_LOG, cb, h); - return rc; + if (IsArm64cc) + return NativeMethods.sqlite3_config_log_arm64cc(raw.SQLITE_CONFIG_LOG, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero, cb, h); + return NativeMethods.sqlite3_config_log(raw.SQLITE_CONFIG_LOG, cb, h); } unsafe void ISQLite3Provider.sqlite3_log(int errcode, utf8z s) @@ -1615,10 +1634,15 @@ static public void Setup(IGetFunctionPointer gf) sqlite3_rekey_v2 = (MyDelegateTypes.sqlite3_rekey_v2) Load(gf, typeof(MyDelegateTypes.sqlite3_rekey_v2)); sqlite3_config_none = (MyDelegateTypes.sqlite3_config_none) Load(gf, typeof(MyDelegateTypes.sqlite3_config_none)); sqlite3_config_int = (MyDelegateTypes.sqlite3_config_int) Load(gf, typeof(MyDelegateTypes.sqlite3_config_int)); + sqlite3_config_int_arm64cc = (MyDelegateTypes.sqlite3_config_int_arm64cc) Load(gf, typeof(MyDelegateTypes.sqlite3_config_int_arm64cc)); sqlite3_config_log = (MyDelegateTypes.sqlite3_config_log) Load(gf, typeof(MyDelegateTypes.sqlite3_config_log)); + sqlite3_config_log_arm64cc = (MyDelegateTypes.sqlite3_config_log_arm64cc) Load(gf, typeof(MyDelegateTypes.sqlite3_config_log_arm64cc)); sqlite3_db_config_charptr = (MyDelegateTypes.sqlite3_db_config_charptr) Load(gf, typeof(MyDelegateTypes.sqlite3_db_config_charptr)); + sqlite3_db_config_charptr_arm64cc = (MyDelegateTypes.sqlite3_db_config_charptr_arm64cc) Load(gf, typeof(MyDelegateTypes.sqlite3_db_config_charptr_arm64cc)); sqlite3_db_config_int_outint = (MyDelegateTypes.sqlite3_db_config_int_outint) Load(gf, typeof(MyDelegateTypes.sqlite3_db_config_int_outint)); + sqlite3_db_config_int_outint_arm64cc = (MyDelegateTypes.sqlite3_db_config_int_outint_arm64cc) Load(gf, typeof(MyDelegateTypes.sqlite3_db_config_int_outint_arm64cc)); sqlite3_db_config_intptr_int_int = (MyDelegateTypes.sqlite3_db_config_intptr_int_int) Load(gf, typeof(MyDelegateTypes.sqlite3_db_config_intptr_int_int)); + sqlite3_db_config_intptr_int_int_arm64cc = (MyDelegateTypes.sqlite3_db_config_intptr_int_int_arm64cc) Load(gf, typeof(MyDelegateTypes.sqlite3_db_config_intptr_int_int_arm64cc)); sqlite3_create_collation = (MyDelegateTypes.sqlite3_create_collation) Load(gf, typeof(MyDelegateTypes.sqlite3_create_collation)); sqlite3_update_hook = (MyDelegateTypes.sqlite3_update_hook) Load(gf, typeof(MyDelegateTypes.sqlite3_update_hook)); sqlite3_commit_hook = (MyDelegateTypes.sqlite3_commit_hook) Load(gf, typeof(MyDelegateTypes.sqlite3_commit_hook)); @@ -1762,10 +1786,15 @@ static public void Setup(IGetFunctionPointer gf) public static MyDelegateTypes.sqlite3_rekey_v2 sqlite3_rekey_v2; public static MyDelegateTypes.sqlite3_config_none sqlite3_config_none; public static MyDelegateTypes.sqlite3_config_int sqlite3_config_int; + public static MyDelegateTypes.sqlite3_config_int_arm64cc sqlite3_config_int_arm64cc; public static MyDelegateTypes.sqlite3_config_log sqlite3_config_log; + public static MyDelegateTypes.sqlite3_config_log_arm64cc sqlite3_config_log_arm64cc; public static MyDelegateTypes.sqlite3_db_config_charptr sqlite3_db_config_charptr; + public static MyDelegateTypes.sqlite3_db_config_charptr_arm64cc sqlite3_db_config_charptr_arm64cc; public static MyDelegateTypes.sqlite3_db_config_int_outint sqlite3_db_config_int_outint; + public static MyDelegateTypes.sqlite3_db_config_int_outint_arm64cc sqlite3_db_config_int_outint_arm64cc; public static MyDelegateTypes.sqlite3_db_config_intptr_int_int sqlite3_db_config_intptr_int_int; + public static MyDelegateTypes.sqlite3_db_config_intptr_int_int_arm64cc sqlite3_db_config_intptr_int_int_arm64cc; public static MyDelegateTypes.sqlite3_create_collation sqlite3_create_collation; public static MyDelegateTypes.sqlite3_update_hook sqlite3_update_hook; public static MyDelegateTypes.sqlite3_commit_hook sqlite3_commit_hook; @@ -2148,22 +2177,42 @@ static class MyDelegateTypes [EntryPoint("sqlite3_config")] public unsafe delegate int sqlite3_config_int(int op, int val); + [UnmanagedFunctionPointer(CALLING_CONVENTION)] + [EntryPoint("sqlite3_config")] + public unsafe delegate int sqlite3_config_int_arm64cc(int op, IntPtr dummy1, IntPtr dummy2, IntPtr dummy3, IntPtr dummy4, IntPtr dummy5, IntPtr dummy6, IntPtr dummy7, int val); + [UnmanagedFunctionPointer(CALLING_CONVENTION)] [EntryPoint("sqlite3_config")] public unsafe delegate int sqlite3_config_log(int op, NativeMethods.callback_log func, hook_handle pvUser); + [UnmanagedFunctionPointer(CALLING_CONVENTION)] + [EntryPoint("sqlite3_config")] + public unsafe delegate int sqlite3_config_log_arm64cc(int op, IntPtr dummy1, IntPtr dummy2, IntPtr dummy3, IntPtr dummy4, IntPtr dummy5, IntPtr dummy6, IntPtr dummy7, NativeMethods.callback_log func, hook_handle pvUser); + [UnmanagedFunctionPointer(CALLING_CONVENTION)] [EntryPoint("sqlite3_db_config")] public unsafe delegate int sqlite3_db_config_charptr(sqlite3 db, int op, byte* val); + [UnmanagedFunctionPointer(CALLING_CONVENTION)] + [EntryPoint("sqlite3_db_config")] + public unsafe delegate int sqlite3_db_config_charptr_arm64cc(sqlite3 db, int op, IntPtr dummy2, IntPtr dummy3, IntPtr dummy4, IntPtr dummy5, IntPtr dummy6, IntPtr dummy7, byte* val); + [UnmanagedFunctionPointer(CALLING_CONVENTION)] [EntryPoint("sqlite3_db_config")] public unsafe delegate int sqlite3_db_config_int_outint(sqlite3 db, int op, int val, int* result); + [UnmanagedFunctionPointer(CALLING_CONVENTION)] + [EntryPoint("sqlite3_db_config")] + public unsafe delegate int sqlite3_db_config_int_outint_arm64cc(sqlite3 db, int op, IntPtr dummy2, IntPtr dummy3, IntPtr dummy4, IntPtr dummy5, IntPtr dummy6, IntPtr dummy7, int val, int* result); + [UnmanagedFunctionPointer(CALLING_CONVENTION)] [EntryPoint("sqlite3_db_config")] public unsafe delegate int sqlite3_db_config_intptr_int_int(sqlite3 db, int op, IntPtr ptr, int int0, int int1); + [UnmanagedFunctionPointer(CALLING_CONVENTION)] + [EntryPoint("sqlite3_db_config")] + public unsafe delegate int sqlite3_db_config_intptr_int_int_arm64cc(sqlite3 db, int op, IntPtr dummy2, IntPtr dummy3, IntPtr dummy4, IntPtr dummy5, IntPtr dummy6, IntPtr dummy7, IntPtr ptr, int int0, int int1); + [UnmanagedFunctionPointer(CALLING_CONVENTION)] public unsafe delegate int sqlite3_create_collation(sqlite3 db, byte[] strName, int nType, hook_handle pvUser, NativeMethods.callback_collation func); diff --git a/src/SQLitePCLRaw.provider.dynamic_stdcall/Generated/provider_dynamic_stdcall.cs b/src/SQLitePCLRaw.provider.dynamic_stdcall/Generated/provider_dynamic_stdcall.cs index e088d146..bd9219c5 100644 --- a/src/SQLitePCLRaw.provider.dynamic_stdcall/Generated/provider_dynamic_stdcall.cs +++ b/src/SQLitePCLRaw.provider.dynamic_stdcall/Generated/provider_dynamic_stdcall.cs @@ -36,6 +36,10 @@ public sealed class SQLite3Provider_dynamic_stdcall : ISQLite3Provider { const CallingConvention CALLING_CONVENTION = CallingConvention.StdCall; + static readonly bool IsArm64cc = + RuntimeInformation.ProcessArchitecture == Architecture.Arm64 && + (RuntimeInformation.IsOSPlatform(OSPlatform.OSX) || RuntimeInformation.IsOSPlatform(OSPlatform.Create("IOS"))); + private static string _native_library_name; public static void Setup(string name, IGetFunctionPointer gf) { @@ -530,6 +534,9 @@ int ISQLite3Provider.sqlite3_config(int op) int ISQLite3Provider.sqlite3_config(int op, int val) { + if (IsArm64cc) + return NativeMethods.sqlite3_config_int_arm64cc(op, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero, val); + return NativeMethods.sqlite3_config_int(op, val); } @@ -537,6 +544,9 @@ unsafe int ISQLite3Provider.sqlite3_db_config(sqlite3 db, int op, utf8z val) { fixed (byte* p_val = val) { + if (IsArm64cc) + return NativeMethods.sqlite3_db_config_charptr_arm64cc(db, op, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero, p_val); + return NativeMethods.sqlite3_db_config_charptr(db, op, p_val); } } @@ -544,7 +554,12 @@ unsafe int ISQLite3Provider.sqlite3_db_config(sqlite3 db, int op, utf8z val) unsafe int ISQLite3Provider.sqlite3_db_config(sqlite3 db, int op, int val, out int result) { int out_result = 0; - int native_result = NativeMethods.sqlite3_db_config_int_outint(db, op, val, &out_result); + int native_result; + + if (IsArm64cc) + native_result = NativeMethods.sqlite3_db_config_int_outint_arm64cc(db, op, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero, val, &out_result); + else + native_result = NativeMethods.sqlite3_db_config_int_outint(db, op, val, &out_result); result = out_result; @@ -553,6 +568,9 @@ unsafe int ISQLite3Provider.sqlite3_db_config(sqlite3 db, int op, int val, out i int ISQLite3Provider.sqlite3_db_config(sqlite3 db, int op, IntPtr ptr, int int0, int int1) { + if (IsArm64cc) + return NativeMethods.sqlite3_db_config_intptr_int_int_arm64cc(db, op, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero, ptr, int0, int1); + return NativeMethods.sqlite3_db_config_intptr_int_int(db, op, ptr, int0, int1); } @@ -710,8 +728,9 @@ int ISQLite3Provider.sqlite3_config_log(delegate_log func, object v) } var h = new hook_handle(hi); disp_log_hook_handle = h; // TODO if valid - var rc = NativeMethods.sqlite3_config_log(raw.SQLITE_CONFIG_LOG, cb, h); - return rc; + if (IsArm64cc) + return NativeMethods.sqlite3_config_log_arm64cc(raw.SQLITE_CONFIG_LOG, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero, cb, h); + return NativeMethods.sqlite3_config_log(raw.SQLITE_CONFIG_LOG, cb, h); } unsafe void ISQLite3Provider.sqlite3_log(int errcode, utf8z s) @@ -1615,10 +1634,15 @@ static public void Setup(IGetFunctionPointer gf) sqlite3_rekey_v2 = (MyDelegateTypes.sqlite3_rekey_v2) Load(gf, typeof(MyDelegateTypes.sqlite3_rekey_v2)); sqlite3_config_none = (MyDelegateTypes.sqlite3_config_none) Load(gf, typeof(MyDelegateTypes.sqlite3_config_none)); sqlite3_config_int = (MyDelegateTypes.sqlite3_config_int) Load(gf, typeof(MyDelegateTypes.sqlite3_config_int)); + sqlite3_config_int_arm64cc = (MyDelegateTypes.sqlite3_config_int_arm64cc) Load(gf, typeof(MyDelegateTypes.sqlite3_config_int_arm64cc)); sqlite3_config_log = (MyDelegateTypes.sqlite3_config_log) Load(gf, typeof(MyDelegateTypes.sqlite3_config_log)); + sqlite3_config_log_arm64cc = (MyDelegateTypes.sqlite3_config_log_arm64cc) Load(gf, typeof(MyDelegateTypes.sqlite3_config_log_arm64cc)); sqlite3_db_config_charptr = (MyDelegateTypes.sqlite3_db_config_charptr) Load(gf, typeof(MyDelegateTypes.sqlite3_db_config_charptr)); + sqlite3_db_config_charptr_arm64cc = (MyDelegateTypes.sqlite3_db_config_charptr_arm64cc) Load(gf, typeof(MyDelegateTypes.sqlite3_db_config_charptr_arm64cc)); sqlite3_db_config_int_outint = (MyDelegateTypes.sqlite3_db_config_int_outint) Load(gf, typeof(MyDelegateTypes.sqlite3_db_config_int_outint)); + sqlite3_db_config_int_outint_arm64cc = (MyDelegateTypes.sqlite3_db_config_int_outint_arm64cc) Load(gf, typeof(MyDelegateTypes.sqlite3_db_config_int_outint_arm64cc)); sqlite3_db_config_intptr_int_int = (MyDelegateTypes.sqlite3_db_config_intptr_int_int) Load(gf, typeof(MyDelegateTypes.sqlite3_db_config_intptr_int_int)); + sqlite3_db_config_intptr_int_int_arm64cc = (MyDelegateTypes.sqlite3_db_config_intptr_int_int_arm64cc) Load(gf, typeof(MyDelegateTypes.sqlite3_db_config_intptr_int_int_arm64cc)); sqlite3_create_collation = (MyDelegateTypes.sqlite3_create_collation) Load(gf, typeof(MyDelegateTypes.sqlite3_create_collation)); sqlite3_update_hook = (MyDelegateTypes.sqlite3_update_hook) Load(gf, typeof(MyDelegateTypes.sqlite3_update_hook)); sqlite3_commit_hook = (MyDelegateTypes.sqlite3_commit_hook) Load(gf, typeof(MyDelegateTypes.sqlite3_commit_hook)); @@ -1762,10 +1786,15 @@ static public void Setup(IGetFunctionPointer gf) public static MyDelegateTypes.sqlite3_rekey_v2 sqlite3_rekey_v2; public static MyDelegateTypes.sqlite3_config_none sqlite3_config_none; public static MyDelegateTypes.sqlite3_config_int sqlite3_config_int; + public static MyDelegateTypes.sqlite3_config_int_arm64cc sqlite3_config_int_arm64cc; public static MyDelegateTypes.sqlite3_config_log sqlite3_config_log; + public static MyDelegateTypes.sqlite3_config_log_arm64cc sqlite3_config_log_arm64cc; public static MyDelegateTypes.sqlite3_db_config_charptr sqlite3_db_config_charptr; + public static MyDelegateTypes.sqlite3_db_config_charptr_arm64cc sqlite3_db_config_charptr_arm64cc; public static MyDelegateTypes.sqlite3_db_config_int_outint sqlite3_db_config_int_outint; + public static MyDelegateTypes.sqlite3_db_config_int_outint_arm64cc sqlite3_db_config_int_outint_arm64cc; public static MyDelegateTypes.sqlite3_db_config_intptr_int_int sqlite3_db_config_intptr_int_int; + public static MyDelegateTypes.sqlite3_db_config_intptr_int_int_arm64cc sqlite3_db_config_intptr_int_int_arm64cc; public static MyDelegateTypes.sqlite3_create_collation sqlite3_create_collation; public static MyDelegateTypes.sqlite3_update_hook sqlite3_update_hook; public static MyDelegateTypes.sqlite3_commit_hook sqlite3_commit_hook; @@ -2148,22 +2177,42 @@ static class MyDelegateTypes [EntryPoint("sqlite3_config")] public unsafe delegate int sqlite3_config_int(int op, int val); + [UnmanagedFunctionPointer(CALLING_CONVENTION)] + [EntryPoint("sqlite3_config")] + public unsafe delegate int sqlite3_config_int_arm64cc(int op, IntPtr dummy1, IntPtr dummy2, IntPtr dummy3, IntPtr dummy4, IntPtr dummy5, IntPtr dummy6, IntPtr dummy7, int val); + [UnmanagedFunctionPointer(CALLING_CONVENTION)] [EntryPoint("sqlite3_config")] public unsafe delegate int sqlite3_config_log(int op, NativeMethods.callback_log func, hook_handle pvUser); + [UnmanagedFunctionPointer(CALLING_CONVENTION)] + [EntryPoint("sqlite3_config")] + public unsafe delegate int sqlite3_config_log_arm64cc(int op, IntPtr dummy1, IntPtr dummy2, IntPtr dummy3, IntPtr dummy4, IntPtr dummy5, IntPtr dummy6, IntPtr dummy7, NativeMethods.callback_log func, hook_handle pvUser); + [UnmanagedFunctionPointer(CALLING_CONVENTION)] [EntryPoint("sqlite3_db_config")] public unsafe delegate int sqlite3_db_config_charptr(sqlite3 db, int op, byte* val); + [UnmanagedFunctionPointer(CALLING_CONVENTION)] + [EntryPoint("sqlite3_db_config")] + public unsafe delegate int sqlite3_db_config_charptr_arm64cc(sqlite3 db, int op, IntPtr dummy2, IntPtr dummy3, IntPtr dummy4, IntPtr dummy5, IntPtr dummy6, IntPtr dummy7, byte* val); + [UnmanagedFunctionPointer(CALLING_CONVENTION)] [EntryPoint("sqlite3_db_config")] public unsafe delegate int sqlite3_db_config_int_outint(sqlite3 db, int op, int val, int* result); + [UnmanagedFunctionPointer(CALLING_CONVENTION)] + [EntryPoint("sqlite3_db_config")] + public unsafe delegate int sqlite3_db_config_int_outint_arm64cc(sqlite3 db, int op, IntPtr dummy2, IntPtr dummy3, IntPtr dummy4, IntPtr dummy5, IntPtr dummy6, IntPtr dummy7, int val, int* result); + [UnmanagedFunctionPointer(CALLING_CONVENTION)] [EntryPoint("sqlite3_db_config")] public unsafe delegate int sqlite3_db_config_intptr_int_int(sqlite3 db, int op, IntPtr ptr, int int0, int int1); + [UnmanagedFunctionPointer(CALLING_CONVENTION)] + [EntryPoint("sqlite3_db_config")] + public unsafe delegate int sqlite3_db_config_intptr_int_int_arm64cc(sqlite3 db, int op, IntPtr dummy2, IntPtr dummy3, IntPtr dummy4, IntPtr dummy5, IntPtr dummy6, IntPtr dummy7, IntPtr ptr, int int0, int int1); + [UnmanagedFunctionPointer(CALLING_CONVENTION)] public unsafe delegate int sqlite3_create_collation(sqlite3 db, byte[] strName, int nType, hook_handle pvUser, NativeMethods.callback_collation func); diff --git a/src/SQLitePCLRaw.provider.e_sqlcipher.most/Generated/provider_e_sqlcipher.cs b/src/SQLitePCLRaw.provider.e_sqlcipher.most/Generated/provider_e_sqlcipher.cs index 93b0345d..437c156f 100644 --- a/src/SQLitePCLRaw.provider.e_sqlcipher.most/Generated/provider_e_sqlcipher.cs +++ b/src/SQLitePCLRaw.provider.e_sqlcipher.most/Generated/provider_e_sqlcipher.cs @@ -36,6 +36,10 @@ public sealed class SQLite3Provider_e_sqlcipher : ISQLite3Provider { const CallingConvention CALLING_CONVENTION = CallingConvention.Cdecl; + static readonly bool IsArm64cc = + RuntimeInformation.ProcessArchitecture == Architecture.Arm64 && + (RuntimeInformation.IsOSPlatform(OSPlatform.OSX) || RuntimeInformation.IsOSPlatform(OSPlatform.Create("IOS"))); + string ISQLite3Provider.GetNativeLibraryName() { return "e_sqlcipher"; @@ -521,6 +525,9 @@ int ISQLite3Provider.sqlite3_config(int op) int ISQLite3Provider.sqlite3_config(int op, int val) { + if (IsArm64cc) + return NativeMethods.sqlite3_config_int_arm64cc(op, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero, val); + return NativeMethods.sqlite3_config_int(op, val); } @@ -528,6 +535,9 @@ unsafe int ISQLite3Provider.sqlite3_db_config(sqlite3 db, int op, utf8z val) { fixed (byte* p_val = val) { + if (IsArm64cc) + return NativeMethods.sqlite3_db_config_charptr_arm64cc(db, op, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero, p_val); + return NativeMethods.sqlite3_db_config_charptr(db, op, p_val); } } @@ -535,7 +545,12 @@ unsafe int ISQLite3Provider.sqlite3_db_config(sqlite3 db, int op, utf8z val) unsafe int ISQLite3Provider.sqlite3_db_config(sqlite3 db, int op, int val, out int result) { int out_result = 0; - int native_result = NativeMethods.sqlite3_db_config_int_outint(db, op, val, &out_result); + int native_result; + + if (IsArm64cc) + native_result = NativeMethods.sqlite3_db_config_int_outint_arm64cc(db, op, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero, val, &out_result); + else + native_result = NativeMethods.sqlite3_db_config_int_outint(db, op, val, &out_result); result = out_result; @@ -544,6 +559,9 @@ unsafe int ISQLite3Provider.sqlite3_db_config(sqlite3 db, int op, int val, out i int ISQLite3Provider.sqlite3_db_config(sqlite3 db, int op, IntPtr ptr, int int0, int int1) { + if (IsArm64cc) + return NativeMethods.sqlite3_db_config_intptr_int_int_arm64cc(db, op, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero, ptr, int0, int1); + return NativeMethods.sqlite3_db_config_intptr_int_int(db, op, ptr, int0, int1); } @@ -701,8 +719,9 @@ int ISQLite3Provider.sqlite3_config_log(delegate_log func, object v) } var h = new hook_handle(hi); disp_log_hook_handle = h; // TODO if valid - var rc = NativeMethods.sqlite3_config_log(raw.SQLITE_CONFIG_LOG, cb, h); - return rc; + if (IsArm64cc) + return NativeMethods.sqlite3_config_log_arm64cc(raw.SQLITE_CONFIG_LOG, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero, cb, h); + return NativeMethods.sqlite3_config_log(raw.SQLITE_CONFIG_LOG, cb, h); } unsafe void ISQLite3Provider.sqlite3_log(int errcode, utf8z s) @@ -1773,18 +1792,33 @@ static class NativeMethods [DllImport(SQLITE_DLL, ExactSpelling=true, EntryPoint = "sqlite3_config", CallingConvention = CALLING_CONVENTION)] public static extern unsafe int sqlite3_config_int(int op, int val); + [DllImport(SQLITE_DLL, ExactSpelling=true, EntryPoint = "sqlite3_config", CallingConvention = CALLING_CONVENTION)] + public static extern unsafe int sqlite3_config_int_arm64cc(int op, IntPtr dummy1, IntPtr dummy2, IntPtr dummy3, IntPtr dummy4, IntPtr dummy5, IntPtr dummy6, IntPtr dummy7, int val); + [DllImport(SQLITE_DLL, ExactSpelling=true, EntryPoint = "sqlite3_config", CallingConvention = CALLING_CONVENTION)] public static extern unsafe int sqlite3_config_log(int op, NativeMethods.callback_log func, hook_handle pvUser); + [DllImport(SQLITE_DLL, ExactSpelling=true, EntryPoint = "sqlite3_config", CallingConvention = CALLING_CONVENTION)] + public static extern unsafe int sqlite3_config_log_arm64cc(int op, IntPtr dummy1, IntPtr dummy2, IntPtr dummy3, IntPtr dummy4, IntPtr dummy5, IntPtr dummy6, IntPtr dummy7, NativeMethods.callback_log func, hook_handle pvUser); + [DllImport(SQLITE_DLL, ExactSpelling=true, EntryPoint = "sqlite3_db_config", CallingConvention = CALLING_CONVENTION)] public static extern unsafe int sqlite3_db_config_charptr(sqlite3 db, int op, byte* val); + [DllImport(SQLITE_DLL, ExactSpelling=true, EntryPoint = "sqlite3_db_config", CallingConvention = CALLING_CONVENTION)] + public static extern unsafe int sqlite3_db_config_charptr_arm64cc(sqlite3 db, int op, IntPtr dummy2, IntPtr dummy3, IntPtr dummy4, IntPtr dummy5, IntPtr dummy6, IntPtr dummy7, byte* val); + [DllImport(SQLITE_DLL, ExactSpelling=true, EntryPoint = "sqlite3_db_config", CallingConvention = CALLING_CONVENTION)] public static extern unsafe int sqlite3_db_config_int_outint(sqlite3 db, int op, int val, int* result); + [DllImport(SQLITE_DLL, ExactSpelling=true, EntryPoint = "sqlite3_db_config", CallingConvention = CALLING_CONVENTION)] + public static extern unsafe int sqlite3_db_config_int_outint_arm64cc(sqlite3 db, int op, IntPtr dummy2, IntPtr dummy3, IntPtr dummy4, IntPtr dummy5, IntPtr dummy6, IntPtr dummy7, int val, int* result); + [DllImport(SQLITE_DLL, ExactSpelling=true, EntryPoint = "sqlite3_db_config", CallingConvention = CALLING_CONVENTION)] public static extern unsafe int sqlite3_db_config_intptr_int_int(sqlite3 db, int op, IntPtr ptr, int int0, int int1); + [DllImport(SQLITE_DLL, ExactSpelling=true, EntryPoint = "sqlite3_db_config", CallingConvention = CALLING_CONVENTION)] + public static extern unsafe int sqlite3_db_config_intptr_int_int_arm64cc(sqlite3 db, int op, IntPtr dummy2, IntPtr dummy3, IntPtr dummy4, IntPtr dummy5, IntPtr dummy6, IntPtr dummy7, IntPtr ptr, int int0, int int1); + [DllImport(SQLITE_DLL, ExactSpelling=true, CallingConvention = CALLING_CONVENTION)] public static extern unsafe int sqlite3_create_collation(sqlite3 db, byte[] strName, int nType, hook_handle pvUser, NativeMethods.callback_collation func); diff --git a/src/SQLitePCLRaw.provider.e_sqlcipher.net5.0/Generated/provider_e_sqlcipher.cs b/src/SQLitePCLRaw.provider.e_sqlcipher.net5.0/Generated/provider_e_sqlcipher.cs index efedee54..804fe553 100644 --- a/src/SQLitePCLRaw.provider.e_sqlcipher.net5.0/Generated/provider_e_sqlcipher.cs +++ b/src/SQLitePCLRaw.provider.e_sqlcipher.net5.0/Generated/provider_e_sqlcipher.cs @@ -36,6 +36,10 @@ public sealed class SQLite3Provider_e_sqlcipher : ISQLite3Provider { const CallingConvention CALLING_CONVENTION = CallingConvention.Cdecl; + static readonly bool IsArm64cc = + RuntimeInformation.ProcessArchitecture == Architecture.Arm64 && + (RuntimeInformation.IsOSPlatform(OSPlatform.OSX) || RuntimeInformation.IsOSPlatform(OSPlatform.Create("IOS"))); + string ISQLite3Provider.GetNativeLibraryName() { return "e_sqlcipher"; @@ -521,6 +525,9 @@ int ISQLite3Provider.sqlite3_config(int op) int ISQLite3Provider.sqlite3_config(int op, int val) { + if (IsArm64cc) + return NativeMethods.sqlite3_config_int_arm64cc(op, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero, val); + return NativeMethods.sqlite3_config_int(op, val); } @@ -528,6 +535,9 @@ unsafe int ISQLite3Provider.sqlite3_db_config(sqlite3 db, int op, utf8z val) { fixed (byte* p_val = val) { + if (IsArm64cc) + return NativeMethods.sqlite3_db_config_charptr_arm64cc(db, op, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero, p_val); + return NativeMethods.sqlite3_db_config_charptr(db, op, p_val); } } @@ -535,7 +545,12 @@ unsafe int ISQLite3Provider.sqlite3_db_config(sqlite3 db, int op, utf8z val) unsafe int ISQLite3Provider.sqlite3_db_config(sqlite3 db, int op, int val, out int result) { int out_result = 0; - int native_result = NativeMethods.sqlite3_db_config_int_outint(db, op, val, &out_result); + int native_result; + + if (IsArm64cc) + native_result = NativeMethods.sqlite3_db_config_int_outint_arm64cc(db, op, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero, val, &out_result); + else + native_result = NativeMethods.sqlite3_db_config_int_outint(db, op, val, &out_result); result = out_result; @@ -544,6 +559,9 @@ unsafe int ISQLite3Provider.sqlite3_db_config(sqlite3 db, int op, int val, out i int ISQLite3Provider.sqlite3_db_config(sqlite3 db, int op, IntPtr ptr, int int0, int int1) { + if (IsArm64cc) + return NativeMethods.sqlite3_db_config_intptr_int_int_arm64cc(db, op, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero, ptr, int0, int1); + return NativeMethods.sqlite3_db_config_intptr_int_int(db, op, ptr, int0, int1); } @@ -701,8 +719,9 @@ int ISQLite3Provider.sqlite3_config_log(delegate_log func, object v) } var h = new hook_handle(hi); disp_log_hook_handle = h; // TODO if valid - var rc = NativeMethods.sqlite3_config_log(raw.SQLITE_CONFIG_LOG, cb, h); - return rc; + if (IsArm64cc) + return NativeMethods.sqlite3_config_log_arm64cc(raw.SQLITE_CONFIG_LOG, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero, cb, h); + return NativeMethods.sqlite3_config_log(raw.SQLITE_CONFIG_LOG, cb, h); } unsafe void ISQLite3Provider.sqlite3_log(int errcode, utf8z s) @@ -1773,18 +1792,33 @@ static class NativeMethods [DllImport(SQLITE_DLL, ExactSpelling=true, EntryPoint = "sqlite3_config", CallingConvention = CALLING_CONVENTION)] public static extern unsafe int sqlite3_config_int(int op, int val); + [DllImport(SQLITE_DLL, ExactSpelling=true, EntryPoint = "sqlite3_config", CallingConvention = CALLING_CONVENTION)] + public static extern unsafe int sqlite3_config_int_arm64cc(int op, IntPtr dummy1, IntPtr dummy2, IntPtr dummy3, IntPtr dummy4, IntPtr dummy5, IntPtr dummy6, IntPtr dummy7, int val); + [DllImport(SQLITE_DLL, ExactSpelling=true, EntryPoint = "sqlite3_config", CallingConvention = CALLING_CONVENTION)] public static extern unsafe int sqlite3_config_log(int op, NativeMethods.callback_log func, hook_handle pvUser); + [DllImport(SQLITE_DLL, ExactSpelling=true, EntryPoint = "sqlite3_config", CallingConvention = CALLING_CONVENTION)] + public static extern unsafe int sqlite3_config_log_arm64cc(int op, IntPtr dummy1, IntPtr dummy2, IntPtr dummy3, IntPtr dummy4, IntPtr dummy5, IntPtr dummy6, IntPtr dummy7, NativeMethods.callback_log func, hook_handle pvUser); + [DllImport(SQLITE_DLL, ExactSpelling=true, EntryPoint = "sqlite3_db_config", CallingConvention = CALLING_CONVENTION)] public static extern unsafe int sqlite3_db_config_charptr(sqlite3 db, int op, byte* val); + [DllImport(SQLITE_DLL, ExactSpelling=true, EntryPoint = "sqlite3_db_config", CallingConvention = CALLING_CONVENTION)] + public static extern unsafe int sqlite3_db_config_charptr_arm64cc(sqlite3 db, int op, IntPtr dummy2, IntPtr dummy3, IntPtr dummy4, IntPtr dummy5, IntPtr dummy6, IntPtr dummy7, byte* val); + [DllImport(SQLITE_DLL, ExactSpelling=true, EntryPoint = "sqlite3_db_config", CallingConvention = CALLING_CONVENTION)] public static extern unsafe int sqlite3_db_config_int_outint(sqlite3 db, int op, int val, int* result); + [DllImport(SQLITE_DLL, ExactSpelling=true, EntryPoint = "sqlite3_db_config", CallingConvention = CALLING_CONVENTION)] + public static extern unsafe int sqlite3_db_config_int_outint_arm64cc(sqlite3 db, int op, IntPtr dummy2, IntPtr dummy3, IntPtr dummy4, IntPtr dummy5, IntPtr dummy6, IntPtr dummy7, int val, int* result); + [DllImport(SQLITE_DLL, ExactSpelling=true, EntryPoint = "sqlite3_db_config", CallingConvention = CALLING_CONVENTION)] public static extern unsafe int sqlite3_db_config_intptr_int_int(sqlite3 db, int op, IntPtr ptr, int int0, int int1); + [DllImport(SQLITE_DLL, ExactSpelling=true, EntryPoint = "sqlite3_db_config", CallingConvention = CALLING_CONVENTION)] + public static extern unsafe int sqlite3_db_config_intptr_int_int_arm64cc(sqlite3 db, int op, IntPtr dummy2, IntPtr dummy3, IntPtr dummy4, IntPtr dummy5, IntPtr dummy6, IntPtr dummy7, IntPtr ptr, int int0, int int1); + [DllImport(SQLITE_DLL, ExactSpelling=true, CallingConvention = CALLING_CONVENTION)] public static extern unsafe int sqlite3_create_collation(sqlite3 db, byte[] strName, int nType, hook_handle pvUser, NativeMethods.callback_collation func); diff --git a/src/SQLitePCLRaw.provider.e_sqlcipher.uwp/Generated/provider_e_sqlcipher.cs b/src/SQLitePCLRaw.provider.e_sqlcipher.uwp/Generated/provider_e_sqlcipher.cs index ad2d74cb..f18fce07 100644 --- a/src/SQLitePCLRaw.provider.e_sqlcipher.uwp/Generated/provider_e_sqlcipher.cs +++ b/src/SQLitePCLRaw.provider.e_sqlcipher.uwp/Generated/provider_e_sqlcipher.cs @@ -36,6 +36,10 @@ public sealed class SQLite3Provider_e_sqlcipher : ISQLite3Provider { const CallingConvention CALLING_CONVENTION = CallingConvention.Cdecl; + static readonly bool IsArm64cc = + RuntimeInformation.ProcessArchitecture == Architecture.Arm64 && + (RuntimeInformation.IsOSPlatform(OSPlatform.OSX) || RuntimeInformation.IsOSPlatform(OSPlatform.Create("IOS"))); + string ISQLite3Provider.GetNativeLibraryName() { return "e_sqlcipher"; @@ -524,6 +528,9 @@ int ISQLite3Provider.sqlite3_config(int op) int ISQLite3Provider.sqlite3_config(int op, int val) { + if (IsArm64cc) + return NativeMethods.sqlite3_config_int_arm64cc(op, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero, val); + return NativeMethods.sqlite3_config_int(op, val); } @@ -531,6 +538,9 @@ unsafe int ISQLite3Provider.sqlite3_db_config(sqlite3 db, int op, utf8z val) { fixed (byte* p_val = val) { + if (IsArm64cc) + return NativeMethods.sqlite3_db_config_charptr_arm64cc(db, op, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero, p_val); + return NativeMethods.sqlite3_db_config_charptr(db, op, p_val); } } @@ -538,7 +548,12 @@ unsafe int ISQLite3Provider.sqlite3_db_config(sqlite3 db, int op, utf8z val) unsafe int ISQLite3Provider.sqlite3_db_config(sqlite3 db, int op, int val, out int result) { int out_result = 0; - int native_result = NativeMethods.sqlite3_db_config_int_outint(db, op, val, &out_result); + int native_result; + + if (IsArm64cc) + native_result = NativeMethods.sqlite3_db_config_int_outint_arm64cc(db, op, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero, val, &out_result); + else + native_result = NativeMethods.sqlite3_db_config_int_outint(db, op, val, &out_result); result = out_result; @@ -547,6 +562,9 @@ unsafe int ISQLite3Provider.sqlite3_db_config(sqlite3 db, int op, int val, out i int ISQLite3Provider.sqlite3_db_config(sqlite3 db, int op, IntPtr ptr, int int0, int int1) { + if (IsArm64cc) + return NativeMethods.sqlite3_db_config_intptr_int_int_arm64cc(db, op, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero, ptr, int0, int1); + return NativeMethods.sqlite3_db_config_intptr_int_int(db, op, ptr, int0, int1); } @@ -704,8 +722,9 @@ int ISQLite3Provider.sqlite3_config_log(delegate_log func, object v) } var h = new hook_handle(hi); disp_log_hook_handle = h; // TODO if valid - var rc = NativeMethods.sqlite3_config_log(raw.SQLITE_CONFIG_LOG, cb, h); - return rc; + if (IsArm64cc) + return NativeMethods.sqlite3_config_log_arm64cc(raw.SQLITE_CONFIG_LOG, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero, cb, h); + return NativeMethods.sqlite3_config_log(raw.SQLITE_CONFIG_LOG, cb, h); } unsafe void ISQLite3Provider.sqlite3_log(int errcode, utf8z s) @@ -1776,18 +1795,33 @@ static class NativeMethods [DllImport(SQLITE_DLL, ExactSpelling=true, EntryPoint = "sqlite3_config", CallingConvention = CALLING_CONVENTION)] public static extern unsafe int sqlite3_config_int(int op, int val); + [DllImport(SQLITE_DLL, ExactSpelling=true, EntryPoint = "sqlite3_config", CallingConvention = CALLING_CONVENTION)] + public static extern unsafe int sqlite3_config_int_arm64cc(int op, IntPtr dummy1, IntPtr dummy2, IntPtr dummy3, IntPtr dummy4, IntPtr dummy5, IntPtr dummy6, IntPtr dummy7, int val); + [DllImport(SQLITE_DLL, ExactSpelling=true, EntryPoint = "sqlite3_config", CallingConvention = CALLING_CONVENTION)] public static extern unsafe int sqlite3_config_log(int op, NativeMethods.callback_log func, hook_handle pvUser); + [DllImport(SQLITE_DLL, ExactSpelling=true, EntryPoint = "sqlite3_config", CallingConvention = CALLING_CONVENTION)] + public static extern unsafe int sqlite3_config_log_arm64cc(int op, IntPtr dummy1, IntPtr dummy2, IntPtr dummy3, IntPtr dummy4, IntPtr dummy5, IntPtr dummy6, IntPtr dummy7, NativeMethods.callback_log func, hook_handle pvUser); + [DllImport(SQLITE_DLL, ExactSpelling=true, EntryPoint = "sqlite3_db_config", CallingConvention = CALLING_CONVENTION)] public static extern unsafe int sqlite3_db_config_charptr(sqlite3 db, int op, byte* val); + [DllImport(SQLITE_DLL, ExactSpelling=true, EntryPoint = "sqlite3_db_config", CallingConvention = CALLING_CONVENTION)] + public static extern unsafe int sqlite3_db_config_charptr_arm64cc(sqlite3 db, int op, IntPtr dummy2, IntPtr dummy3, IntPtr dummy4, IntPtr dummy5, IntPtr dummy6, IntPtr dummy7, byte* val); + [DllImport(SQLITE_DLL, ExactSpelling=true, EntryPoint = "sqlite3_db_config", CallingConvention = CALLING_CONVENTION)] public static extern unsafe int sqlite3_db_config_int_outint(sqlite3 db, int op, int val, int* result); + [DllImport(SQLITE_DLL, ExactSpelling=true, EntryPoint = "sqlite3_db_config", CallingConvention = CALLING_CONVENTION)] + public static extern unsafe int sqlite3_db_config_int_outint_arm64cc(sqlite3 db, int op, IntPtr dummy2, IntPtr dummy3, IntPtr dummy4, IntPtr dummy5, IntPtr dummy6, IntPtr dummy7, int val, int* result); + [DllImport(SQLITE_DLL, ExactSpelling=true, EntryPoint = "sqlite3_db_config", CallingConvention = CALLING_CONVENTION)] public static extern unsafe int sqlite3_db_config_intptr_int_int(sqlite3 db, int op, IntPtr ptr, int int0, int int1); + [DllImport(SQLITE_DLL, ExactSpelling=true, EntryPoint = "sqlite3_db_config", CallingConvention = CALLING_CONVENTION)] + public static extern unsafe int sqlite3_db_config_intptr_int_int_arm64cc(sqlite3 db, int op, IntPtr dummy2, IntPtr dummy3, IntPtr dummy4, IntPtr dummy5, IntPtr dummy6, IntPtr dummy7, IntPtr ptr, int int0, int int1); + [DllImport(SQLITE_DLL, ExactSpelling=true, CallingConvention = CALLING_CONVENTION)] public static extern unsafe int sqlite3_create_collation(sqlite3 db, byte[] strName, int nType, hook_handle pvUser, NativeMethods.callback_collation func); diff --git a/src/SQLitePCLRaw.provider.e_sqlite3.most/Generated/provider_e_sqlite3.cs b/src/SQLitePCLRaw.provider.e_sqlite3.most/Generated/provider_e_sqlite3.cs index 17227bbe..161bb9b3 100644 --- a/src/SQLitePCLRaw.provider.e_sqlite3.most/Generated/provider_e_sqlite3.cs +++ b/src/SQLitePCLRaw.provider.e_sqlite3.most/Generated/provider_e_sqlite3.cs @@ -36,6 +36,10 @@ public sealed class SQLite3Provider_e_sqlite3 : ISQLite3Provider { const CallingConvention CALLING_CONVENTION = CallingConvention.Cdecl; + static readonly bool IsArm64cc = + RuntimeInformation.ProcessArchitecture == Architecture.Arm64 && + (RuntimeInformation.IsOSPlatform(OSPlatform.OSX) || RuntimeInformation.IsOSPlatform(OSPlatform.Create("IOS"))); + string ISQLite3Provider.GetNativeLibraryName() { return "e_sqlite3"; @@ -509,6 +513,9 @@ int ISQLite3Provider.sqlite3_config(int op) int ISQLite3Provider.sqlite3_config(int op, int val) { + if (IsArm64cc) + return NativeMethods.sqlite3_config_int_arm64cc(op, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero, val); + return NativeMethods.sqlite3_config_int(op, val); } @@ -516,6 +523,9 @@ unsafe int ISQLite3Provider.sqlite3_db_config(sqlite3 db, int op, utf8z val) { fixed (byte* p_val = val) { + if (IsArm64cc) + return NativeMethods.sqlite3_db_config_charptr_arm64cc(db, op, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero, p_val); + return NativeMethods.sqlite3_db_config_charptr(db, op, p_val); } } @@ -523,7 +533,12 @@ unsafe int ISQLite3Provider.sqlite3_db_config(sqlite3 db, int op, utf8z val) unsafe int ISQLite3Provider.sqlite3_db_config(sqlite3 db, int op, int val, out int result) { int out_result = 0; - int native_result = NativeMethods.sqlite3_db_config_int_outint(db, op, val, &out_result); + int native_result; + + if (IsArm64cc) + native_result = NativeMethods.sqlite3_db_config_int_outint_arm64cc(db, op, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero, val, &out_result); + else + native_result = NativeMethods.sqlite3_db_config_int_outint(db, op, val, &out_result); result = out_result; @@ -532,6 +547,9 @@ unsafe int ISQLite3Provider.sqlite3_db_config(sqlite3 db, int op, int val, out i int ISQLite3Provider.sqlite3_db_config(sqlite3 db, int op, IntPtr ptr, int int0, int int1) { + if (IsArm64cc) + return NativeMethods.sqlite3_db_config_intptr_int_int_arm64cc(db, op, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero, ptr, int0, int1); + return NativeMethods.sqlite3_db_config_intptr_int_int(db, op, ptr, int0, int1); } @@ -689,8 +707,9 @@ int ISQLite3Provider.sqlite3_config_log(delegate_log func, object v) } var h = new hook_handle(hi); disp_log_hook_handle = h; // TODO if valid - var rc = NativeMethods.sqlite3_config_log(raw.SQLITE_CONFIG_LOG, cb, h); - return rc; + if (IsArm64cc) + return NativeMethods.sqlite3_config_log_arm64cc(raw.SQLITE_CONFIG_LOG, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero, cb, h); + return NativeMethods.sqlite3_config_log(raw.SQLITE_CONFIG_LOG, cb, h); } unsafe void ISQLite3Provider.sqlite3_log(int errcode, utf8z s) @@ -1749,18 +1768,33 @@ static class NativeMethods [DllImport(SQLITE_DLL, ExactSpelling=true, EntryPoint = "sqlite3_config", CallingConvention = CALLING_CONVENTION)] public static extern unsafe int sqlite3_config_int(int op, int val); + [DllImport(SQLITE_DLL, ExactSpelling=true, EntryPoint = "sqlite3_config", CallingConvention = CALLING_CONVENTION)] + public static extern unsafe int sqlite3_config_int_arm64cc(int op, IntPtr dummy1, IntPtr dummy2, IntPtr dummy3, IntPtr dummy4, IntPtr dummy5, IntPtr dummy6, IntPtr dummy7, int val); + [DllImport(SQLITE_DLL, ExactSpelling=true, EntryPoint = "sqlite3_config", CallingConvention = CALLING_CONVENTION)] public static extern unsafe int sqlite3_config_log(int op, NativeMethods.callback_log func, hook_handle pvUser); + [DllImport(SQLITE_DLL, ExactSpelling=true, EntryPoint = "sqlite3_config", CallingConvention = CALLING_CONVENTION)] + public static extern unsafe int sqlite3_config_log_arm64cc(int op, IntPtr dummy1, IntPtr dummy2, IntPtr dummy3, IntPtr dummy4, IntPtr dummy5, IntPtr dummy6, IntPtr dummy7, NativeMethods.callback_log func, hook_handle pvUser); + [DllImport(SQLITE_DLL, ExactSpelling=true, EntryPoint = "sqlite3_db_config", CallingConvention = CALLING_CONVENTION)] public static extern unsafe int sqlite3_db_config_charptr(sqlite3 db, int op, byte* val); + [DllImport(SQLITE_DLL, ExactSpelling=true, EntryPoint = "sqlite3_db_config", CallingConvention = CALLING_CONVENTION)] + public static extern unsafe int sqlite3_db_config_charptr_arm64cc(sqlite3 db, int op, IntPtr dummy2, IntPtr dummy3, IntPtr dummy4, IntPtr dummy5, IntPtr dummy6, IntPtr dummy7, byte* val); + [DllImport(SQLITE_DLL, ExactSpelling=true, EntryPoint = "sqlite3_db_config", CallingConvention = CALLING_CONVENTION)] public static extern unsafe int sqlite3_db_config_int_outint(sqlite3 db, int op, int val, int* result); + [DllImport(SQLITE_DLL, ExactSpelling=true, EntryPoint = "sqlite3_db_config", CallingConvention = CALLING_CONVENTION)] + public static extern unsafe int sqlite3_db_config_int_outint_arm64cc(sqlite3 db, int op, IntPtr dummy2, IntPtr dummy3, IntPtr dummy4, IntPtr dummy5, IntPtr dummy6, IntPtr dummy7, int val, int* result); + [DllImport(SQLITE_DLL, ExactSpelling=true, EntryPoint = "sqlite3_db_config", CallingConvention = CALLING_CONVENTION)] public static extern unsafe int sqlite3_db_config_intptr_int_int(sqlite3 db, int op, IntPtr ptr, int int0, int int1); + [DllImport(SQLITE_DLL, ExactSpelling=true, EntryPoint = "sqlite3_db_config", CallingConvention = CALLING_CONVENTION)] + public static extern unsafe int sqlite3_db_config_intptr_int_int_arm64cc(sqlite3 db, int op, IntPtr dummy2, IntPtr dummy3, IntPtr dummy4, IntPtr dummy5, IntPtr dummy6, IntPtr dummy7, IntPtr ptr, int int0, int int1); + [DllImport(SQLITE_DLL, ExactSpelling=true, CallingConvention = CALLING_CONVENTION)] public static extern unsafe int sqlite3_create_collation(sqlite3 db, byte[] strName, int nType, hook_handle pvUser, NativeMethods.callback_collation func); diff --git a/src/SQLitePCLRaw.provider.e_sqlite3.net5.0/Generated/provider_e_sqlite3.cs b/src/SQLitePCLRaw.provider.e_sqlite3.net5.0/Generated/provider_e_sqlite3.cs index 6a729940..c2f2663a 100644 --- a/src/SQLitePCLRaw.provider.e_sqlite3.net5.0/Generated/provider_e_sqlite3.cs +++ b/src/SQLitePCLRaw.provider.e_sqlite3.net5.0/Generated/provider_e_sqlite3.cs @@ -36,6 +36,10 @@ public sealed class SQLite3Provider_e_sqlite3 : ISQLite3Provider { const CallingConvention CALLING_CONVENTION = CallingConvention.Cdecl; + static readonly bool IsArm64cc = + RuntimeInformation.ProcessArchitecture == Architecture.Arm64 && + (RuntimeInformation.IsOSPlatform(OSPlatform.OSX) || RuntimeInformation.IsOSPlatform(OSPlatform.Create("IOS"))); + string ISQLite3Provider.GetNativeLibraryName() { return "e_sqlite3"; @@ -509,6 +513,9 @@ int ISQLite3Provider.sqlite3_config(int op) int ISQLite3Provider.sqlite3_config(int op, int val) { + if (IsArm64cc) + return NativeMethods.sqlite3_config_int_arm64cc(op, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero, val); + return NativeMethods.sqlite3_config_int(op, val); } @@ -516,6 +523,9 @@ unsafe int ISQLite3Provider.sqlite3_db_config(sqlite3 db, int op, utf8z val) { fixed (byte* p_val = val) { + if (IsArm64cc) + return NativeMethods.sqlite3_db_config_charptr_arm64cc(db, op, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero, p_val); + return NativeMethods.sqlite3_db_config_charptr(db, op, p_val); } } @@ -523,7 +533,12 @@ unsafe int ISQLite3Provider.sqlite3_db_config(sqlite3 db, int op, utf8z val) unsafe int ISQLite3Provider.sqlite3_db_config(sqlite3 db, int op, int val, out int result) { int out_result = 0; - int native_result = NativeMethods.sqlite3_db_config_int_outint(db, op, val, &out_result); + int native_result; + + if (IsArm64cc) + native_result = NativeMethods.sqlite3_db_config_int_outint_arm64cc(db, op, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero, val, &out_result); + else + native_result = NativeMethods.sqlite3_db_config_int_outint(db, op, val, &out_result); result = out_result; @@ -532,6 +547,9 @@ unsafe int ISQLite3Provider.sqlite3_db_config(sqlite3 db, int op, int val, out i int ISQLite3Provider.sqlite3_db_config(sqlite3 db, int op, IntPtr ptr, int int0, int int1) { + if (IsArm64cc) + return NativeMethods.sqlite3_db_config_intptr_int_int_arm64cc(db, op, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero, ptr, int0, int1); + return NativeMethods.sqlite3_db_config_intptr_int_int(db, op, ptr, int0, int1); } @@ -689,8 +707,9 @@ int ISQLite3Provider.sqlite3_config_log(delegate_log func, object v) } var h = new hook_handle(hi); disp_log_hook_handle = h; // TODO if valid - var rc = NativeMethods.sqlite3_config_log(raw.SQLITE_CONFIG_LOG, cb, h); - return rc; + if (IsArm64cc) + return NativeMethods.sqlite3_config_log_arm64cc(raw.SQLITE_CONFIG_LOG, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero, cb, h); + return NativeMethods.sqlite3_config_log(raw.SQLITE_CONFIG_LOG, cb, h); } unsafe void ISQLite3Provider.sqlite3_log(int errcode, utf8z s) @@ -1749,18 +1768,33 @@ static class NativeMethods [DllImport(SQLITE_DLL, ExactSpelling=true, EntryPoint = "sqlite3_config", CallingConvention = CALLING_CONVENTION)] public static extern unsafe int sqlite3_config_int(int op, int val); + [DllImport(SQLITE_DLL, ExactSpelling=true, EntryPoint = "sqlite3_config", CallingConvention = CALLING_CONVENTION)] + public static extern unsafe int sqlite3_config_int_arm64cc(int op, IntPtr dummy1, IntPtr dummy2, IntPtr dummy3, IntPtr dummy4, IntPtr dummy5, IntPtr dummy6, IntPtr dummy7, int val); + [DllImport(SQLITE_DLL, ExactSpelling=true, EntryPoint = "sqlite3_config", CallingConvention = CALLING_CONVENTION)] public static extern unsafe int sqlite3_config_log(int op, NativeMethods.callback_log func, hook_handle pvUser); + [DllImport(SQLITE_DLL, ExactSpelling=true, EntryPoint = "sqlite3_config", CallingConvention = CALLING_CONVENTION)] + public static extern unsafe int sqlite3_config_log_arm64cc(int op, IntPtr dummy1, IntPtr dummy2, IntPtr dummy3, IntPtr dummy4, IntPtr dummy5, IntPtr dummy6, IntPtr dummy7, NativeMethods.callback_log func, hook_handle pvUser); + [DllImport(SQLITE_DLL, ExactSpelling=true, EntryPoint = "sqlite3_db_config", CallingConvention = CALLING_CONVENTION)] public static extern unsafe int sqlite3_db_config_charptr(sqlite3 db, int op, byte* val); + [DllImport(SQLITE_DLL, ExactSpelling=true, EntryPoint = "sqlite3_db_config", CallingConvention = CALLING_CONVENTION)] + public static extern unsafe int sqlite3_db_config_charptr_arm64cc(sqlite3 db, int op, IntPtr dummy2, IntPtr dummy3, IntPtr dummy4, IntPtr dummy5, IntPtr dummy6, IntPtr dummy7, byte* val); + [DllImport(SQLITE_DLL, ExactSpelling=true, EntryPoint = "sqlite3_db_config", CallingConvention = CALLING_CONVENTION)] public static extern unsafe int sqlite3_db_config_int_outint(sqlite3 db, int op, int val, int* result); + [DllImport(SQLITE_DLL, ExactSpelling=true, EntryPoint = "sqlite3_db_config", CallingConvention = CALLING_CONVENTION)] + public static extern unsafe int sqlite3_db_config_int_outint_arm64cc(sqlite3 db, int op, IntPtr dummy2, IntPtr dummy3, IntPtr dummy4, IntPtr dummy5, IntPtr dummy6, IntPtr dummy7, int val, int* result); + [DllImport(SQLITE_DLL, ExactSpelling=true, EntryPoint = "sqlite3_db_config", CallingConvention = CALLING_CONVENTION)] public static extern unsafe int sqlite3_db_config_intptr_int_int(sqlite3 db, int op, IntPtr ptr, int int0, int int1); + [DllImport(SQLITE_DLL, ExactSpelling=true, EntryPoint = "sqlite3_db_config", CallingConvention = CALLING_CONVENTION)] + public static extern unsafe int sqlite3_db_config_intptr_int_int_arm64cc(sqlite3 db, int op, IntPtr dummy2, IntPtr dummy3, IntPtr dummy4, IntPtr dummy5, IntPtr dummy6, IntPtr dummy7, IntPtr ptr, int int0, int int1); + [DllImport(SQLITE_DLL, ExactSpelling=true, CallingConvention = CALLING_CONVENTION)] public static extern unsafe int sqlite3_create_collation(sqlite3 db, byte[] strName, int nType, hook_handle pvUser, NativeMethods.callback_collation func); diff --git a/src/SQLitePCLRaw.provider.e_sqlite3.uwp/Generated/provider_e_sqlite3.cs b/src/SQLitePCLRaw.provider.e_sqlite3.uwp/Generated/provider_e_sqlite3.cs index 42d42329..09d78a41 100644 --- a/src/SQLitePCLRaw.provider.e_sqlite3.uwp/Generated/provider_e_sqlite3.cs +++ b/src/SQLitePCLRaw.provider.e_sqlite3.uwp/Generated/provider_e_sqlite3.cs @@ -36,6 +36,10 @@ public sealed class SQLite3Provider_e_sqlite3 : ISQLite3Provider { const CallingConvention CALLING_CONVENTION = CallingConvention.Cdecl; + static readonly bool IsArm64cc = + RuntimeInformation.ProcessArchitecture == Architecture.Arm64 && + (RuntimeInformation.IsOSPlatform(OSPlatform.OSX) || RuntimeInformation.IsOSPlatform(OSPlatform.Create("IOS"))); + string ISQLite3Provider.GetNativeLibraryName() { return "e_sqlite3"; @@ -512,6 +516,9 @@ int ISQLite3Provider.sqlite3_config(int op) int ISQLite3Provider.sqlite3_config(int op, int val) { + if (IsArm64cc) + return NativeMethods.sqlite3_config_int_arm64cc(op, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero, val); + return NativeMethods.sqlite3_config_int(op, val); } @@ -519,6 +526,9 @@ unsafe int ISQLite3Provider.sqlite3_db_config(sqlite3 db, int op, utf8z val) { fixed (byte* p_val = val) { + if (IsArm64cc) + return NativeMethods.sqlite3_db_config_charptr_arm64cc(db, op, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero, p_val); + return NativeMethods.sqlite3_db_config_charptr(db, op, p_val); } } @@ -526,7 +536,12 @@ unsafe int ISQLite3Provider.sqlite3_db_config(sqlite3 db, int op, utf8z val) unsafe int ISQLite3Provider.sqlite3_db_config(sqlite3 db, int op, int val, out int result) { int out_result = 0; - int native_result = NativeMethods.sqlite3_db_config_int_outint(db, op, val, &out_result); + int native_result; + + if (IsArm64cc) + native_result = NativeMethods.sqlite3_db_config_int_outint_arm64cc(db, op, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero, val, &out_result); + else + native_result = NativeMethods.sqlite3_db_config_int_outint(db, op, val, &out_result); result = out_result; @@ -535,6 +550,9 @@ unsafe int ISQLite3Provider.sqlite3_db_config(sqlite3 db, int op, int val, out i int ISQLite3Provider.sqlite3_db_config(sqlite3 db, int op, IntPtr ptr, int int0, int int1) { + if (IsArm64cc) + return NativeMethods.sqlite3_db_config_intptr_int_int_arm64cc(db, op, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero, ptr, int0, int1); + return NativeMethods.sqlite3_db_config_intptr_int_int(db, op, ptr, int0, int1); } @@ -692,8 +710,9 @@ int ISQLite3Provider.sqlite3_config_log(delegate_log func, object v) } var h = new hook_handle(hi); disp_log_hook_handle = h; // TODO if valid - var rc = NativeMethods.sqlite3_config_log(raw.SQLITE_CONFIG_LOG, cb, h); - return rc; + if (IsArm64cc) + return NativeMethods.sqlite3_config_log_arm64cc(raw.SQLITE_CONFIG_LOG, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero, cb, h); + return NativeMethods.sqlite3_config_log(raw.SQLITE_CONFIG_LOG, cb, h); } unsafe void ISQLite3Provider.sqlite3_log(int errcode, utf8z s) @@ -1752,18 +1771,33 @@ static class NativeMethods [DllImport(SQLITE_DLL, ExactSpelling=true, EntryPoint = "sqlite3_config", CallingConvention = CALLING_CONVENTION)] public static extern unsafe int sqlite3_config_int(int op, int val); + [DllImport(SQLITE_DLL, ExactSpelling=true, EntryPoint = "sqlite3_config", CallingConvention = CALLING_CONVENTION)] + public static extern unsafe int sqlite3_config_int_arm64cc(int op, IntPtr dummy1, IntPtr dummy2, IntPtr dummy3, IntPtr dummy4, IntPtr dummy5, IntPtr dummy6, IntPtr dummy7, int val); + [DllImport(SQLITE_DLL, ExactSpelling=true, EntryPoint = "sqlite3_config", CallingConvention = CALLING_CONVENTION)] public static extern unsafe int sqlite3_config_log(int op, NativeMethods.callback_log func, hook_handle pvUser); + [DllImport(SQLITE_DLL, ExactSpelling=true, EntryPoint = "sqlite3_config", CallingConvention = CALLING_CONVENTION)] + public static extern unsafe int sqlite3_config_log_arm64cc(int op, IntPtr dummy1, IntPtr dummy2, IntPtr dummy3, IntPtr dummy4, IntPtr dummy5, IntPtr dummy6, IntPtr dummy7, NativeMethods.callback_log func, hook_handle pvUser); + [DllImport(SQLITE_DLL, ExactSpelling=true, EntryPoint = "sqlite3_db_config", CallingConvention = CALLING_CONVENTION)] public static extern unsafe int sqlite3_db_config_charptr(sqlite3 db, int op, byte* val); + [DllImport(SQLITE_DLL, ExactSpelling=true, EntryPoint = "sqlite3_db_config", CallingConvention = CALLING_CONVENTION)] + public static extern unsafe int sqlite3_db_config_charptr_arm64cc(sqlite3 db, int op, IntPtr dummy2, IntPtr dummy3, IntPtr dummy4, IntPtr dummy5, IntPtr dummy6, IntPtr dummy7, byte* val); + [DllImport(SQLITE_DLL, ExactSpelling=true, EntryPoint = "sqlite3_db_config", CallingConvention = CALLING_CONVENTION)] public static extern unsafe int sqlite3_db_config_int_outint(sqlite3 db, int op, int val, int* result); + [DllImport(SQLITE_DLL, ExactSpelling=true, EntryPoint = "sqlite3_db_config", CallingConvention = CALLING_CONVENTION)] + public static extern unsafe int sqlite3_db_config_int_outint_arm64cc(sqlite3 db, int op, IntPtr dummy2, IntPtr dummy3, IntPtr dummy4, IntPtr dummy5, IntPtr dummy6, IntPtr dummy7, int val, int* result); + [DllImport(SQLITE_DLL, ExactSpelling=true, EntryPoint = "sqlite3_db_config", CallingConvention = CALLING_CONVENTION)] public static extern unsafe int sqlite3_db_config_intptr_int_int(sqlite3 db, int op, IntPtr ptr, int int0, int int1); + [DllImport(SQLITE_DLL, ExactSpelling=true, EntryPoint = "sqlite3_db_config", CallingConvention = CALLING_CONVENTION)] + public static extern unsafe int sqlite3_db_config_intptr_int_int_arm64cc(sqlite3 db, int op, IntPtr dummy2, IntPtr dummy3, IntPtr dummy4, IntPtr dummy5, IntPtr dummy6, IntPtr dummy7, IntPtr ptr, int int0, int int1); + [DllImport(SQLITE_DLL, ExactSpelling=true, CallingConvention = CALLING_CONVENTION)] public static extern unsafe int sqlite3_create_collation(sqlite3 db, byte[] strName, int nType, hook_handle pvUser, NativeMethods.callback_collation func); diff --git a/src/SQLitePCLRaw.provider.internal/Generated/provider_internal.cs b/src/SQLitePCLRaw.provider.internal/Generated/provider_internal.cs index 330b1a68..3bc0c36b 100644 --- a/src/SQLitePCLRaw.provider.internal/Generated/provider_internal.cs +++ b/src/SQLitePCLRaw.provider.internal/Generated/provider_internal.cs @@ -36,6 +36,10 @@ public sealed class SQLite3Provider_internal : ISQLite3Provider { const CallingConvention CALLING_CONVENTION = CallingConvention.Cdecl; + static readonly bool IsArm64cc = + RuntimeInformation.ProcessArchitecture == Architecture.Arm64 && + (RuntimeInformation.IsOSPlatform(OSPlatform.OSX) || RuntimeInformation.IsOSPlatform(OSPlatform.Create("IOS"))); + string ISQLite3Provider.GetNativeLibraryName() { return "__Internal"; @@ -521,6 +525,9 @@ int ISQLite3Provider.sqlite3_config(int op) int ISQLite3Provider.sqlite3_config(int op, int val) { + if (IsArm64cc) + return NativeMethods.sqlite3_config_int_arm64cc(op, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero, val); + return NativeMethods.sqlite3_config_int(op, val); } @@ -528,6 +535,9 @@ unsafe int ISQLite3Provider.sqlite3_db_config(sqlite3 db, int op, utf8z val) { fixed (byte* p_val = val) { + if (IsArm64cc) + return NativeMethods.sqlite3_db_config_charptr_arm64cc(db, op, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero, p_val); + return NativeMethods.sqlite3_db_config_charptr(db, op, p_val); } } @@ -535,7 +545,12 @@ unsafe int ISQLite3Provider.sqlite3_db_config(sqlite3 db, int op, utf8z val) unsafe int ISQLite3Provider.sqlite3_db_config(sqlite3 db, int op, int val, out int result) { int out_result = 0; - int native_result = NativeMethods.sqlite3_db_config_int_outint(db, op, val, &out_result); + int native_result; + + if (IsArm64cc) + native_result = NativeMethods.sqlite3_db_config_int_outint_arm64cc(db, op, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero, val, &out_result); + else + native_result = NativeMethods.sqlite3_db_config_int_outint(db, op, val, &out_result); result = out_result; @@ -544,6 +559,9 @@ unsafe int ISQLite3Provider.sqlite3_db_config(sqlite3 db, int op, int val, out i int ISQLite3Provider.sqlite3_db_config(sqlite3 db, int op, IntPtr ptr, int int0, int int1) { + if (IsArm64cc) + return NativeMethods.sqlite3_db_config_intptr_int_int_arm64cc(db, op, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero, ptr, int0, int1); + return NativeMethods.sqlite3_db_config_intptr_int_int(db, op, ptr, int0, int1); } @@ -701,8 +719,9 @@ int ISQLite3Provider.sqlite3_config_log(delegate_log func, object v) } var h = new hook_handle(hi); disp_log_hook_handle = h; // TODO if valid - var rc = NativeMethods.sqlite3_config_log(raw.SQLITE_CONFIG_LOG, cb, h); - return rc; + if (IsArm64cc) + return NativeMethods.sqlite3_config_log_arm64cc(raw.SQLITE_CONFIG_LOG, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero, cb, h); + return NativeMethods.sqlite3_config_log(raw.SQLITE_CONFIG_LOG, cb, h); } unsafe void ISQLite3Provider.sqlite3_log(int errcode, utf8z s) @@ -1773,18 +1792,33 @@ static class NativeMethods [DllImport(SQLITE_DLL, ExactSpelling=true, EntryPoint = "sqlite3_config", CallingConvention = CALLING_CONVENTION)] public static extern unsafe int sqlite3_config_int(int op, int val); + [DllImport(SQLITE_DLL, ExactSpelling=true, EntryPoint = "sqlite3_config", CallingConvention = CALLING_CONVENTION)] + public static extern unsafe int sqlite3_config_int_arm64cc(int op, IntPtr dummy1, IntPtr dummy2, IntPtr dummy3, IntPtr dummy4, IntPtr dummy5, IntPtr dummy6, IntPtr dummy7, int val); + [DllImport(SQLITE_DLL, ExactSpelling=true, EntryPoint = "sqlite3_config", CallingConvention = CALLING_CONVENTION)] public static extern unsafe int sqlite3_config_log(int op, NativeMethods.callback_log func, hook_handle pvUser); + [DllImport(SQLITE_DLL, ExactSpelling=true, EntryPoint = "sqlite3_config", CallingConvention = CALLING_CONVENTION)] + public static extern unsafe int sqlite3_config_log_arm64cc(int op, IntPtr dummy1, IntPtr dummy2, IntPtr dummy3, IntPtr dummy4, IntPtr dummy5, IntPtr dummy6, IntPtr dummy7, NativeMethods.callback_log func, hook_handle pvUser); + [DllImport(SQLITE_DLL, ExactSpelling=true, EntryPoint = "sqlite3_db_config", CallingConvention = CALLING_CONVENTION)] public static extern unsafe int sqlite3_db_config_charptr(sqlite3 db, int op, byte* val); + [DllImport(SQLITE_DLL, ExactSpelling=true, EntryPoint = "sqlite3_db_config", CallingConvention = CALLING_CONVENTION)] + public static extern unsafe int sqlite3_db_config_charptr_arm64cc(sqlite3 db, int op, IntPtr dummy2, IntPtr dummy3, IntPtr dummy4, IntPtr dummy5, IntPtr dummy6, IntPtr dummy7, byte* val); + [DllImport(SQLITE_DLL, ExactSpelling=true, EntryPoint = "sqlite3_db_config", CallingConvention = CALLING_CONVENTION)] public static extern unsafe int sqlite3_db_config_int_outint(sqlite3 db, int op, int val, int* result); + [DllImport(SQLITE_DLL, ExactSpelling=true, EntryPoint = "sqlite3_db_config", CallingConvention = CALLING_CONVENTION)] + public static extern unsafe int sqlite3_db_config_int_outint_arm64cc(sqlite3 db, int op, IntPtr dummy2, IntPtr dummy3, IntPtr dummy4, IntPtr dummy5, IntPtr dummy6, IntPtr dummy7, int val, int* result); + [DllImport(SQLITE_DLL, ExactSpelling=true, EntryPoint = "sqlite3_db_config", CallingConvention = CALLING_CONVENTION)] public static extern unsafe int sqlite3_db_config_intptr_int_int(sqlite3 db, int op, IntPtr ptr, int int0, int int1); + [DllImport(SQLITE_DLL, ExactSpelling=true, EntryPoint = "sqlite3_db_config", CallingConvention = CALLING_CONVENTION)] + public static extern unsafe int sqlite3_db_config_intptr_int_int_arm64cc(sqlite3 db, int op, IntPtr dummy2, IntPtr dummy3, IntPtr dummy4, IntPtr dummy5, IntPtr dummy6, IntPtr dummy7, IntPtr ptr, int int0, int int1); + [DllImport(SQLITE_DLL, ExactSpelling=true, CallingConvention = CALLING_CONVENTION)] public static extern unsafe int sqlite3_create_collation(sqlite3 db, byte[] strName, int nType, hook_handle pvUser, NativeMethods.callback_collation func); diff --git a/src/SQLitePCLRaw.provider.sqlcipher.most/Generated/provider_sqlcipher.cs b/src/SQLitePCLRaw.provider.sqlcipher.most/Generated/provider_sqlcipher.cs index e491c146..53b16d13 100644 --- a/src/SQLitePCLRaw.provider.sqlcipher.most/Generated/provider_sqlcipher.cs +++ b/src/SQLitePCLRaw.provider.sqlcipher.most/Generated/provider_sqlcipher.cs @@ -36,6 +36,10 @@ public sealed class SQLite3Provider_sqlcipher : ISQLite3Provider { const CallingConvention CALLING_CONVENTION = CallingConvention.Cdecl; + static readonly bool IsArm64cc = + RuntimeInformation.ProcessArchitecture == Architecture.Arm64 && + (RuntimeInformation.IsOSPlatform(OSPlatform.OSX) || RuntimeInformation.IsOSPlatform(OSPlatform.Create("IOS"))); + string ISQLite3Provider.GetNativeLibraryName() { return "sqlcipher"; @@ -521,6 +525,9 @@ int ISQLite3Provider.sqlite3_config(int op) int ISQLite3Provider.sqlite3_config(int op, int val) { + if (IsArm64cc) + return NativeMethods.sqlite3_config_int_arm64cc(op, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero, val); + return NativeMethods.sqlite3_config_int(op, val); } @@ -528,6 +535,9 @@ unsafe int ISQLite3Provider.sqlite3_db_config(sqlite3 db, int op, utf8z val) { fixed (byte* p_val = val) { + if (IsArm64cc) + return NativeMethods.sqlite3_db_config_charptr_arm64cc(db, op, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero, p_val); + return NativeMethods.sqlite3_db_config_charptr(db, op, p_val); } } @@ -535,7 +545,12 @@ unsafe int ISQLite3Provider.sqlite3_db_config(sqlite3 db, int op, utf8z val) unsafe int ISQLite3Provider.sqlite3_db_config(sqlite3 db, int op, int val, out int result) { int out_result = 0; - int native_result = NativeMethods.sqlite3_db_config_int_outint(db, op, val, &out_result); + int native_result; + + if (IsArm64cc) + native_result = NativeMethods.sqlite3_db_config_int_outint_arm64cc(db, op, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero, val, &out_result); + else + native_result = NativeMethods.sqlite3_db_config_int_outint(db, op, val, &out_result); result = out_result; @@ -544,6 +559,9 @@ unsafe int ISQLite3Provider.sqlite3_db_config(sqlite3 db, int op, int val, out i int ISQLite3Provider.sqlite3_db_config(sqlite3 db, int op, IntPtr ptr, int int0, int int1) { + if (IsArm64cc) + return NativeMethods.sqlite3_db_config_intptr_int_int_arm64cc(db, op, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero, ptr, int0, int1); + return NativeMethods.sqlite3_db_config_intptr_int_int(db, op, ptr, int0, int1); } @@ -701,8 +719,9 @@ int ISQLite3Provider.sqlite3_config_log(delegate_log func, object v) } var h = new hook_handle(hi); disp_log_hook_handle = h; // TODO if valid - var rc = NativeMethods.sqlite3_config_log(raw.SQLITE_CONFIG_LOG, cb, h); - return rc; + if (IsArm64cc) + return NativeMethods.sqlite3_config_log_arm64cc(raw.SQLITE_CONFIG_LOG, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero, cb, h); + return NativeMethods.sqlite3_config_log(raw.SQLITE_CONFIG_LOG, cb, h); } unsafe void ISQLite3Provider.sqlite3_log(int errcode, utf8z s) @@ -1773,18 +1792,33 @@ static class NativeMethods [DllImport(SQLITE_DLL, ExactSpelling=true, EntryPoint = "sqlite3_config", CallingConvention = CALLING_CONVENTION)] public static extern unsafe int sqlite3_config_int(int op, int val); + [DllImport(SQLITE_DLL, ExactSpelling=true, EntryPoint = "sqlite3_config", CallingConvention = CALLING_CONVENTION)] + public static extern unsafe int sqlite3_config_int_arm64cc(int op, IntPtr dummy1, IntPtr dummy2, IntPtr dummy3, IntPtr dummy4, IntPtr dummy5, IntPtr dummy6, IntPtr dummy7, int val); + [DllImport(SQLITE_DLL, ExactSpelling=true, EntryPoint = "sqlite3_config", CallingConvention = CALLING_CONVENTION)] public static extern unsafe int sqlite3_config_log(int op, NativeMethods.callback_log func, hook_handle pvUser); + [DllImport(SQLITE_DLL, ExactSpelling=true, EntryPoint = "sqlite3_config", CallingConvention = CALLING_CONVENTION)] + public static extern unsafe int sqlite3_config_log_arm64cc(int op, IntPtr dummy1, IntPtr dummy2, IntPtr dummy3, IntPtr dummy4, IntPtr dummy5, IntPtr dummy6, IntPtr dummy7, NativeMethods.callback_log func, hook_handle pvUser); + [DllImport(SQLITE_DLL, ExactSpelling=true, EntryPoint = "sqlite3_db_config", CallingConvention = CALLING_CONVENTION)] public static extern unsafe int sqlite3_db_config_charptr(sqlite3 db, int op, byte* val); + [DllImport(SQLITE_DLL, ExactSpelling=true, EntryPoint = "sqlite3_db_config", CallingConvention = CALLING_CONVENTION)] + public static extern unsafe int sqlite3_db_config_charptr_arm64cc(sqlite3 db, int op, IntPtr dummy2, IntPtr dummy3, IntPtr dummy4, IntPtr dummy5, IntPtr dummy6, IntPtr dummy7, byte* val); + [DllImport(SQLITE_DLL, ExactSpelling=true, EntryPoint = "sqlite3_db_config", CallingConvention = CALLING_CONVENTION)] public static extern unsafe int sqlite3_db_config_int_outint(sqlite3 db, int op, int val, int* result); + [DllImport(SQLITE_DLL, ExactSpelling=true, EntryPoint = "sqlite3_db_config", CallingConvention = CALLING_CONVENTION)] + public static extern unsafe int sqlite3_db_config_int_outint_arm64cc(sqlite3 db, int op, IntPtr dummy2, IntPtr dummy3, IntPtr dummy4, IntPtr dummy5, IntPtr dummy6, IntPtr dummy7, int val, int* result); + [DllImport(SQLITE_DLL, ExactSpelling=true, EntryPoint = "sqlite3_db_config", CallingConvention = CALLING_CONVENTION)] public static extern unsafe int sqlite3_db_config_intptr_int_int(sqlite3 db, int op, IntPtr ptr, int int0, int int1); + [DllImport(SQLITE_DLL, ExactSpelling=true, EntryPoint = "sqlite3_db_config", CallingConvention = CALLING_CONVENTION)] + public static extern unsafe int sqlite3_db_config_intptr_int_int_arm64cc(sqlite3 db, int op, IntPtr dummy2, IntPtr dummy3, IntPtr dummy4, IntPtr dummy5, IntPtr dummy6, IntPtr dummy7, IntPtr ptr, int int0, int int1); + [DllImport(SQLITE_DLL, ExactSpelling=true, CallingConvention = CALLING_CONVENTION)] public static extern unsafe int sqlite3_create_collation(sqlite3 db, byte[] strName, int nType, hook_handle pvUser, NativeMethods.callback_collation func); diff --git a/src/SQLitePCLRaw.provider.sqlcipher.net5.0/Generated/provider_sqlcipher.cs b/src/SQLitePCLRaw.provider.sqlcipher.net5.0/Generated/provider_sqlcipher.cs index 09ac5afa..5af388f8 100644 --- a/src/SQLitePCLRaw.provider.sqlcipher.net5.0/Generated/provider_sqlcipher.cs +++ b/src/SQLitePCLRaw.provider.sqlcipher.net5.0/Generated/provider_sqlcipher.cs @@ -36,6 +36,10 @@ public sealed class SQLite3Provider_sqlcipher : ISQLite3Provider { const CallingConvention CALLING_CONVENTION = CallingConvention.Cdecl; + static readonly bool IsArm64cc = + RuntimeInformation.ProcessArchitecture == Architecture.Arm64 && + (RuntimeInformation.IsOSPlatform(OSPlatform.OSX) || RuntimeInformation.IsOSPlatform(OSPlatform.Create("IOS"))); + string ISQLite3Provider.GetNativeLibraryName() { return "sqlcipher"; @@ -521,6 +525,9 @@ int ISQLite3Provider.sqlite3_config(int op) int ISQLite3Provider.sqlite3_config(int op, int val) { + if (IsArm64cc) + return NativeMethods.sqlite3_config_int_arm64cc(op, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero, val); + return NativeMethods.sqlite3_config_int(op, val); } @@ -528,6 +535,9 @@ unsafe int ISQLite3Provider.sqlite3_db_config(sqlite3 db, int op, utf8z val) { fixed (byte* p_val = val) { + if (IsArm64cc) + return NativeMethods.sqlite3_db_config_charptr_arm64cc(db, op, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero, p_val); + return NativeMethods.sqlite3_db_config_charptr(db, op, p_val); } } @@ -535,7 +545,12 @@ unsafe int ISQLite3Provider.sqlite3_db_config(sqlite3 db, int op, utf8z val) unsafe int ISQLite3Provider.sqlite3_db_config(sqlite3 db, int op, int val, out int result) { int out_result = 0; - int native_result = NativeMethods.sqlite3_db_config_int_outint(db, op, val, &out_result); + int native_result; + + if (IsArm64cc) + native_result = NativeMethods.sqlite3_db_config_int_outint_arm64cc(db, op, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero, val, &out_result); + else + native_result = NativeMethods.sqlite3_db_config_int_outint(db, op, val, &out_result); result = out_result; @@ -544,6 +559,9 @@ unsafe int ISQLite3Provider.sqlite3_db_config(sqlite3 db, int op, int val, out i int ISQLite3Provider.sqlite3_db_config(sqlite3 db, int op, IntPtr ptr, int int0, int int1) { + if (IsArm64cc) + return NativeMethods.sqlite3_db_config_intptr_int_int_arm64cc(db, op, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero, ptr, int0, int1); + return NativeMethods.sqlite3_db_config_intptr_int_int(db, op, ptr, int0, int1); } @@ -701,8 +719,9 @@ int ISQLite3Provider.sqlite3_config_log(delegate_log func, object v) } var h = new hook_handle(hi); disp_log_hook_handle = h; // TODO if valid - var rc = NativeMethods.sqlite3_config_log(raw.SQLITE_CONFIG_LOG, cb, h); - return rc; + if (IsArm64cc) + return NativeMethods.sqlite3_config_log_arm64cc(raw.SQLITE_CONFIG_LOG, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero, cb, h); + return NativeMethods.sqlite3_config_log(raw.SQLITE_CONFIG_LOG, cb, h); } unsafe void ISQLite3Provider.sqlite3_log(int errcode, utf8z s) @@ -1773,18 +1792,33 @@ static class NativeMethods [DllImport(SQLITE_DLL, ExactSpelling=true, EntryPoint = "sqlite3_config", CallingConvention = CALLING_CONVENTION)] public static extern unsafe int sqlite3_config_int(int op, int val); + [DllImport(SQLITE_DLL, ExactSpelling=true, EntryPoint = "sqlite3_config", CallingConvention = CALLING_CONVENTION)] + public static extern unsafe int sqlite3_config_int_arm64cc(int op, IntPtr dummy1, IntPtr dummy2, IntPtr dummy3, IntPtr dummy4, IntPtr dummy5, IntPtr dummy6, IntPtr dummy7, int val); + [DllImport(SQLITE_DLL, ExactSpelling=true, EntryPoint = "sqlite3_config", CallingConvention = CALLING_CONVENTION)] public static extern unsafe int sqlite3_config_log(int op, NativeMethods.callback_log func, hook_handle pvUser); + [DllImport(SQLITE_DLL, ExactSpelling=true, EntryPoint = "sqlite3_config", CallingConvention = CALLING_CONVENTION)] + public static extern unsafe int sqlite3_config_log_arm64cc(int op, IntPtr dummy1, IntPtr dummy2, IntPtr dummy3, IntPtr dummy4, IntPtr dummy5, IntPtr dummy6, IntPtr dummy7, NativeMethods.callback_log func, hook_handle pvUser); + [DllImport(SQLITE_DLL, ExactSpelling=true, EntryPoint = "sqlite3_db_config", CallingConvention = CALLING_CONVENTION)] public static extern unsafe int sqlite3_db_config_charptr(sqlite3 db, int op, byte* val); + [DllImport(SQLITE_DLL, ExactSpelling=true, EntryPoint = "sqlite3_db_config", CallingConvention = CALLING_CONVENTION)] + public static extern unsafe int sqlite3_db_config_charptr_arm64cc(sqlite3 db, int op, IntPtr dummy2, IntPtr dummy3, IntPtr dummy4, IntPtr dummy5, IntPtr dummy6, IntPtr dummy7, byte* val); + [DllImport(SQLITE_DLL, ExactSpelling=true, EntryPoint = "sqlite3_db_config", CallingConvention = CALLING_CONVENTION)] public static extern unsafe int sqlite3_db_config_int_outint(sqlite3 db, int op, int val, int* result); + [DllImport(SQLITE_DLL, ExactSpelling=true, EntryPoint = "sqlite3_db_config", CallingConvention = CALLING_CONVENTION)] + public static extern unsafe int sqlite3_db_config_int_outint_arm64cc(sqlite3 db, int op, IntPtr dummy2, IntPtr dummy3, IntPtr dummy4, IntPtr dummy5, IntPtr dummy6, IntPtr dummy7, int val, int* result); + [DllImport(SQLITE_DLL, ExactSpelling=true, EntryPoint = "sqlite3_db_config", CallingConvention = CALLING_CONVENTION)] public static extern unsafe int sqlite3_db_config_intptr_int_int(sqlite3 db, int op, IntPtr ptr, int int0, int int1); + [DllImport(SQLITE_DLL, ExactSpelling=true, EntryPoint = "sqlite3_db_config", CallingConvention = CALLING_CONVENTION)] + public static extern unsafe int sqlite3_db_config_intptr_int_int_arm64cc(sqlite3 db, int op, IntPtr dummy2, IntPtr dummy3, IntPtr dummy4, IntPtr dummy5, IntPtr dummy6, IntPtr dummy7, IntPtr ptr, int int0, int int1); + [DllImport(SQLITE_DLL, ExactSpelling=true, CallingConvention = CALLING_CONVENTION)] public static extern unsafe int sqlite3_create_collation(sqlite3 db, byte[] strName, int nType, hook_handle pvUser, NativeMethods.callback_collation func); diff --git a/src/SQLitePCLRaw.provider.sqlcipher.uwp/Generated/provider_sqlcipher.cs b/src/SQLitePCLRaw.provider.sqlcipher.uwp/Generated/provider_sqlcipher.cs index 5aa83ebf..03311d68 100644 --- a/src/SQLitePCLRaw.provider.sqlcipher.uwp/Generated/provider_sqlcipher.cs +++ b/src/SQLitePCLRaw.provider.sqlcipher.uwp/Generated/provider_sqlcipher.cs @@ -36,6 +36,10 @@ public sealed class SQLite3Provider_sqlcipher : ISQLite3Provider { const CallingConvention CALLING_CONVENTION = CallingConvention.Cdecl; + static readonly bool IsArm64cc = + RuntimeInformation.ProcessArchitecture == Architecture.Arm64 && + (RuntimeInformation.IsOSPlatform(OSPlatform.OSX) || RuntimeInformation.IsOSPlatform(OSPlatform.Create("IOS"))); + string ISQLite3Provider.GetNativeLibraryName() { return "sqlcipher"; @@ -524,6 +528,9 @@ int ISQLite3Provider.sqlite3_config(int op) int ISQLite3Provider.sqlite3_config(int op, int val) { + if (IsArm64cc) + return NativeMethods.sqlite3_config_int_arm64cc(op, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero, val); + return NativeMethods.sqlite3_config_int(op, val); } @@ -531,6 +538,9 @@ unsafe int ISQLite3Provider.sqlite3_db_config(sqlite3 db, int op, utf8z val) { fixed (byte* p_val = val) { + if (IsArm64cc) + return NativeMethods.sqlite3_db_config_charptr_arm64cc(db, op, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero, p_val); + return NativeMethods.sqlite3_db_config_charptr(db, op, p_val); } } @@ -538,7 +548,12 @@ unsafe int ISQLite3Provider.sqlite3_db_config(sqlite3 db, int op, utf8z val) unsafe int ISQLite3Provider.sqlite3_db_config(sqlite3 db, int op, int val, out int result) { int out_result = 0; - int native_result = NativeMethods.sqlite3_db_config_int_outint(db, op, val, &out_result); + int native_result; + + if (IsArm64cc) + native_result = NativeMethods.sqlite3_db_config_int_outint_arm64cc(db, op, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero, val, &out_result); + else + native_result = NativeMethods.sqlite3_db_config_int_outint(db, op, val, &out_result); result = out_result; @@ -547,6 +562,9 @@ unsafe int ISQLite3Provider.sqlite3_db_config(sqlite3 db, int op, int val, out i int ISQLite3Provider.sqlite3_db_config(sqlite3 db, int op, IntPtr ptr, int int0, int int1) { + if (IsArm64cc) + return NativeMethods.sqlite3_db_config_intptr_int_int_arm64cc(db, op, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero, ptr, int0, int1); + return NativeMethods.sqlite3_db_config_intptr_int_int(db, op, ptr, int0, int1); } @@ -704,8 +722,9 @@ int ISQLite3Provider.sqlite3_config_log(delegate_log func, object v) } var h = new hook_handle(hi); disp_log_hook_handle = h; // TODO if valid - var rc = NativeMethods.sqlite3_config_log(raw.SQLITE_CONFIG_LOG, cb, h); - return rc; + if (IsArm64cc) + return NativeMethods.sqlite3_config_log_arm64cc(raw.SQLITE_CONFIG_LOG, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero, cb, h); + return NativeMethods.sqlite3_config_log(raw.SQLITE_CONFIG_LOG, cb, h); } unsafe void ISQLite3Provider.sqlite3_log(int errcode, utf8z s) @@ -1776,18 +1795,33 @@ static class NativeMethods [DllImport(SQLITE_DLL, ExactSpelling=true, EntryPoint = "sqlite3_config", CallingConvention = CALLING_CONVENTION)] public static extern unsafe int sqlite3_config_int(int op, int val); + [DllImport(SQLITE_DLL, ExactSpelling=true, EntryPoint = "sqlite3_config", CallingConvention = CALLING_CONVENTION)] + public static extern unsafe int sqlite3_config_int_arm64cc(int op, IntPtr dummy1, IntPtr dummy2, IntPtr dummy3, IntPtr dummy4, IntPtr dummy5, IntPtr dummy6, IntPtr dummy7, int val); + [DllImport(SQLITE_DLL, ExactSpelling=true, EntryPoint = "sqlite3_config", CallingConvention = CALLING_CONVENTION)] public static extern unsafe int sqlite3_config_log(int op, NativeMethods.callback_log func, hook_handle pvUser); + [DllImport(SQLITE_DLL, ExactSpelling=true, EntryPoint = "sqlite3_config", CallingConvention = CALLING_CONVENTION)] + public static extern unsafe int sqlite3_config_log_arm64cc(int op, IntPtr dummy1, IntPtr dummy2, IntPtr dummy3, IntPtr dummy4, IntPtr dummy5, IntPtr dummy6, IntPtr dummy7, NativeMethods.callback_log func, hook_handle pvUser); + [DllImport(SQLITE_DLL, ExactSpelling=true, EntryPoint = "sqlite3_db_config", CallingConvention = CALLING_CONVENTION)] public static extern unsafe int sqlite3_db_config_charptr(sqlite3 db, int op, byte* val); + [DllImport(SQLITE_DLL, ExactSpelling=true, EntryPoint = "sqlite3_db_config", CallingConvention = CALLING_CONVENTION)] + public static extern unsafe int sqlite3_db_config_charptr_arm64cc(sqlite3 db, int op, IntPtr dummy2, IntPtr dummy3, IntPtr dummy4, IntPtr dummy5, IntPtr dummy6, IntPtr dummy7, byte* val); + [DllImport(SQLITE_DLL, ExactSpelling=true, EntryPoint = "sqlite3_db_config", CallingConvention = CALLING_CONVENTION)] public static extern unsafe int sqlite3_db_config_int_outint(sqlite3 db, int op, int val, int* result); + [DllImport(SQLITE_DLL, ExactSpelling=true, EntryPoint = "sqlite3_db_config", CallingConvention = CALLING_CONVENTION)] + public static extern unsafe int sqlite3_db_config_int_outint_arm64cc(sqlite3 db, int op, IntPtr dummy2, IntPtr dummy3, IntPtr dummy4, IntPtr dummy5, IntPtr dummy6, IntPtr dummy7, int val, int* result); + [DllImport(SQLITE_DLL, ExactSpelling=true, EntryPoint = "sqlite3_db_config", CallingConvention = CALLING_CONVENTION)] public static extern unsafe int sqlite3_db_config_intptr_int_int(sqlite3 db, int op, IntPtr ptr, int int0, int int1); + [DllImport(SQLITE_DLL, ExactSpelling=true, EntryPoint = "sqlite3_db_config", CallingConvention = CALLING_CONVENTION)] + public static extern unsafe int sqlite3_db_config_intptr_int_int_arm64cc(sqlite3 db, int op, IntPtr dummy2, IntPtr dummy3, IntPtr dummy4, IntPtr dummy5, IntPtr dummy6, IntPtr dummy7, IntPtr ptr, int int0, int int1); + [DllImport(SQLITE_DLL, ExactSpelling=true, CallingConvention = CALLING_CONVENTION)] public static extern unsafe int sqlite3_create_collation(sqlite3 db, byte[] strName, int nType, hook_handle pvUser, NativeMethods.callback_collation func); diff --git a/src/SQLitePCLRaw.provider.sqlite3.most/Generated/provider_sqlite3.cs b/src/SQLitePCLRaw.provider.sqlite3.most/Generated/provider_sqlite3.cs index c7fc6f01..1d641dcd 100644 --- a/src/SQLitePCLRaw.provider.sqlite3.most/Generated/provider_sqlite3.cs +++ b/src/SQLitePCLRaw.provider.sqlite3.most/Generated/provider_sqlite3.cs @@ -36,6 +36,10 @@ public sealed class SQLite3Provider_sqlite3 : ISQLite3Provider { const CallingConvention CALLING_CONVENTION = CallingConvention.Cdecl; + static readonly bool IsArm64cc = + RuntimeInformation.ProcessArchitecture == Architecture.Arm64 && + (RuntimeInformation.IsOSPlatform(OSPlatform.OSX) || RuntimeInformation.IsOSPlatform(OSPlatform.Create("IOS"))); + string ISQLite3Provider.GetNativeLibraryName() { return "sqlite3"; @@ -509,6 +513,9 @@ int ISQLite3Provider.sqlite3_config(int op) int ISQLite3Provider.sqlite3_config(int op, int val) { + if (IsArm64cc) + return NativeMethods.sqlite3_config_int_arm64cc(op, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero, val); + return NativeMethods.sqlite3_config_int(op, val); } @@ -516,6 +523,9 @@ unsafe int ISQLite3Provider.sqlite3_db_config(sqlite3 db, int op, utf8z val) { fixed (byte* p_val = val) { + if (IsArm64cc) + return NativeMethods.sqlite3_db_config_charptr_arm64cc(db, op, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero, p_val); + return NativeMethods.sqlite3_db_config_charptr(db, op, p_val); } } @@ -523,7 +533,12 @@ unsafe int ISQLite3Provider.sqlite3_db_config(sqlite3 db, int op, utf8z val) unsafe int ISQLite3Provider.sqlite3_db_config(sqlite3 db, int op, int val, out int result) { int out_result = 0; - int native_result = NativeMethods.sqlite3_db_config_int_outint(db, op, val, &out_result); + int native_result; + + if (IsArm64cc) + native_result = NativeMethods.sqlite3_db_config_int_outint_arm64cc(db, op, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero, val, &out_result); + else + native_result = NativeMethods.sqlite3_db_config_int_outint(db, op, val, &out_result); result = out_result; @@ -532,6 +547,9 @@ unsafe int ISQLite3Provider.sqlite3_db_config(sqlite3 db, int op, int val, out i int ISQLite3Provider.sqlite3_db_config(sqlite3 db, int op, IntPtr ptr, int int0, int int1) { + if (IsArm64cc) + return NativeMethods.sqlite3_db_config_intptr_int_int_arm64cc(db, op, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero, ptr, int0, int1); + return NativeMethods.sqlite3_db_config_intptr_int_int(db, op, ptr, int0, int1); } @@ -689,8 +707,9 @@ int ISQLite3Provider.sqlite3_config_log(delegate_log func, object v) } var h = new hook_handle(hi); disp_log_hook_handle = h; // TODO if valid - var rc = NativeMethods.sqlite3_config_log(raw.SQLITE_CONFIG_LOG, cb, h); - return rc; + if (IsArm64cc) + return NativeMethods.sqlite3_config_log_arm64cc(raw.SQLITE_CONFIG_LOG, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero, cb, h); + return NativeMethods.sqlite3_config_log(raw.SQLITE_CONFIG_LOG, cb, h); } unsafe void ISQLite3Provider.sqlite3_log(int errcode, utf8z s) @@ -1749,18 +1768,33 @@ static class NativeMethods [DllImport(SQLITE_DLL, ExactSpelling=true, EntryPoint = "sqlite3_config", CallingConvention = CALLING_CONVENTION)] public static extern unsafe int sqlite3_config_int(int op, int val); + [DllImport(SQLITE_DLL, ExactSpelling=true, EntryPoint = "sqlite3_config", CallingConvention = CALLING_CONVENTION)] + public static extern unsafe int sqlite3_config_int_arm64cc(int op, IntPtr dummy1, IntPtr dummy2, IntPtr dummy3, IntPtr dummy4, IntPtr dummy5, IntPtr dummy6, IntPtr dummy7, int val); + [DllImport(SQLITE_DLL, ExactSpelling=true, EntryPoint = "sqlite3_config", CallingConvention = CALLING_CONVENTION)] public static extern unsafe int sqlite3_config_log(int op, NativeMethods.callback_log func, hook_handle pvUser); + [DllImport(SQLITE_DLL, ExactSpelling=true, EntryPoint = "sqlite3_config", CallingConvention = CALLING_CONVENTION)] + public static extern unsafe int sqlite3_config_log_arm64cc(int op, IntPtr dummy1, IntPtr dummy2, IntPtr dummy3, IntPtr dummy4, IntPtr dummy5, IntPtr dummy6, IntPtr dummy7, NativeMethods.callback_log func, hook_handle pvUser); + [DllImport(SQLITE_DLL, ExactSpelling=true, EntryPoint = "sqlite3_db_config", CallingConvention = CALLING_CONVENTION)] public static extern unsafe int sqlite3_db_config_charptr(sqlite3 db, int op, byte* val); + [DllImport(SQLITE_DLL, ExactSpelling=true, EntryPoint = "sqlite3_db_config", CallingConvention = CALLING_CONVENTION)] + public static extern unsafe int sqlite3_db_config_charptr_arm64cc(sqlite3 db, int op, IntPtr dummy2, IntPtr dummy3, IntPtr dummy4, IntPtr dummy5, IntPtr dummy6, IntPtr dummy7, byte* val); + [DllImport(SQLITE_DLL, ExactSpelling=true, EntryPoint = "sqlite3_db_config", CallingConvention = CALLING_CONVENTION)] public static extern unsafe int sqlite3_db_config_int_outint(sqlite3 db, int op, int val, int* result); + [DllImport(SQLITE_DLL, ExactSpelling=true, EntryPoint = "sqlite3_db_config", CallingConvention = CALLING_CONVENTION)] + public static extern unsafe int sqlite3_db_config_int_outint_arm64cc(sqlite3 db, int op, IntPtr dummy2, IntPtr dummy3, IntPtr dummy4, IntPtr dummy5, IntPtr dummy6, IntPtr dummy7, int val, int* result); + [DllImport(SQLITE_DLL, ExactSpelling=true, EntryPoint = "sqlite3_db_config", CallingConvention = CALLING_CONVENTION)] public static extern unsafe int sqlite3_db_config_intptr_int_int(sqlite3 db, int op, IntPtr ptr, int int0, int int1); + [DllImport(SQLITE_DLL, ExactSpelling=true, EntryPoint = "sqlite3_db_config", CallingConvention = CALLING_CONVENTION)] + public static extern unsafe int sqlite3_db_config_intptr_int_int_arm64cc(sqlite3 db, int op, IntPtr dummy2, IntPtr dummy3, IntPtr dummy4, IntPtr dummy5, IntPtr dummy6, IntPtr dummy7, IntPtr ptr, int int0, int int1); + [DllImport(SQLITE_DLL, ExactSpelling=true, CallingConvention = CALLING_CONVENTION)] public static extern unsafe int sqlite3_create_collation(sqlite3 db, byte[] strName, int nType, hook_handle pvUser, NativeMethods.callback_collation func); diff --git a/src/SQLitePCLRaw.provider.sqlite3.net5.0/Generated/provider_sqlite3.cs b/src/SQLitePCLRaw.provider.sqlite3.net5.0/Generated/provider_sqlite3.cs index 0fe34274..0169d27e 100644 --- a/src/SQLitePCLRaw.provider.sqlite3.net5.0/Generated/provider_sqlite3.cs +++ b/src/SQLitePCLRaw.provider.sqlite3.net5.0/Generated/provider_sqlite3.cs @@ -36,6 +36,10 @@ public sealed class SQLite3Provider_sqlite3 : ISQLite3Provider { const CallingConvention CALLING_CONVENTION = CallingConvention.Cdecl; + static readonly bool IsArm64cc = + RuntimeInformation.ProcessArchitecture == Architecture.Arm64 && + (RuntimeInformation.IsOSPlatform(OSPlatform.OSX) || RuntimeInformation.IsOSPlatform(OSPlatform.Create("IOS"))); + string ISQLite3Provider.GetNativeLibraryName() { return "sqlite3"; @@ -509,6 +513,9 @@ int ISQLite3Provider.sqlite3_config(int op) int ISQLite3Provider.sqlite3_config(int op, int val) { + if (IsArm64cc) + return NativeMethods.sqlite3_config_int_arm64cc(op, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero, val); + return NativeMethods.sqlite3_config_int(op, val); } @@ -516,6 +523,9 @@ unsafe int ISQLite3Provider.sqlite3_db_config(sqlite3 db, int op, utf8z val) { fixed (byte* p_val = val) { + if (IsArm64cc) + return NativeMethods.sqlite3_db_config_charptr_arm64cc(db, op, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero, p_val); + return NativeMethods.sqlite3_db_config_charptr(db, op, p_val); } } @@ -523,7 +533,12 @@ unsafe int ISQLite3Provider.sqlite3_db_config(sqlite3 db, int op, utf8z val) unsafe int ISQLite3Provider.sqlite3_db_config(sqlite3 db, int op, int val, out int result) { int out_result = 0; - int native_result = NativeMethods.sqlite3_db_config_int_outint(db, op, val, &out_result); + int native_result; + + if (IsArm64cc) + native_result = NativeMethods.sqlite3_db_config_int_outint_arm64cc(db, op, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero, val, &out_result); + else + native_result = NativeMethods.sqlite3_db_config_int_outint(db, op, val, &out_result); result = out_result; @@ -532,6 +547,9 @@ unsafe int ISQLite3Provider.sqlite3_db_config(sqlite3 db, int op, int val, out i int ISQLite3Provider.sqlite3_db_config(sqlite3 db, int op, IntPtr ptr, int int0, int int1) { + if (IsArm64cc) + return NativeMethods.sqlite3_db_config_intptr_int_int_arm64cc(db, op, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero, ptr, int0, int1); + return NativeMethods.sqlite3_db_config_intptr_int_int(db, op, ptr, int0, int1); } @@ -689,8 +707,9 @@ int ISQLite3Provider.sqlite3_config_log(delegate_log func, object v) } var h = new hook_handle(hi); disp_log_hook_handle = h; // TODO if valid - var rc = NativeMethods.sqlite3_config_log(raw.SQLITE_CONFIG_LOG, cb, h); - return rc; + if (IsArm64cc) + return NativeMethods.sqlite3_config_log_arm64cc(raw.SQLITE_CONFIG_LOG, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero, cb, h); + return NativeMethods.sqlite3_config_log(raw.SQLITE_CONFIG_LOG, cb, h); } unsafe void ISQLite3Provider.sqlite3_log(int errcode, utf8z s) @@ -1749,18 +1768,33 @@ static class NativeMethods [DllImport(SQLITE_DLL, ExactSpelling=true, EntryPoint = "sqlite3_config", CallingConvention = CALLING_CONVENTION)] public static extern unsafe int sqlite3_config_int(int op, int val); + [DllImport(SQLITE_DLL, ExactSpelling=true, EntryPoint = "sqlite3_config", CallingConvention = CALLING_CONVENTION)] + public static extern unsafe int sqlite3_config_int_arm64cc(int op, IntPtr dummy1, IntPtr dummy2, IntPtr dummy3, IntPtr dummy4, IntPtr dummy5, IntPtr dummy6, IntPtr dummy7, int val); + [DllImport(SQLITE_DLL, ExactSpelling=true, EntryPoint = "sqlite3_config", CallingConvention = CALLING_CONVENTION)] public static extern unsafe int sqlite3_config_log(int op, NativeMethods.callback_log func, hook_handle pvUser); + [DllImport(SQLITE_DLL, ExactSpelling=true, EntryPoint = "sqlite3_config", CallingConvention = CALLING_CONVENTION)] + public static extern unsafe int sqlite3_config_log_arm64cc(int op, IntPtr dummy1, IntPtr dummy2, IntPtr dummy3, IntPtr dummy4, IntPtr dummy5, IntPtr dummy6, IntPtr dummy7, NativeMethods.callback_log func, hook_handle pvUser); + [DllImport(SQLITE_DLL, ExactSpelling=true, EntryPoint = "sqlite3_db_config", CallingConvention = CALLING_CONVENTION)] public static extern unsafe int sqlite3_db_config_charptr(sqlite3 db, int op, byte* val); + [DllImport(SQLITE_DLL, ExactSpelling=true, EntryPoint = "sqlite3_db_config", CallingConvention = CALLING_CONVENTION)] + public static extern unsafe int sqlite3_db_config_charptr_arm64cc(sqlite3 db, int op, IntPtr dummy2, IntPtr dummy3, IntPtr dummy4, IntPtr dummy5, IntPtr dummy6, IntPtr dummy7, byte* val); + [DllImport(SQLITE_DLL, ExactSpelling=true, EntryPoint = "sqlite3_db_config", CallingConvention = CALLING_CONVENTION)] public static extern unsafe int sqlite3_db_config_int_outint(sqlite3 db, int op, int val, int* result); + [DllImport(SQLITE_DLL, ExactSpelling=true, EntryPoint = "sqlite3_db_config", CallingConvention = CALLING_CONVENTION)] + public static extern unsafe int sqlite3_db_config_int_outint_arm64cc(sqlite3 db, int op, IntPtr dummy2, IntPtr dummy3, IntPtr dummy4, IntPtr dummy5, IntPtr dummy6, IntPtr dummy7, int val, int* result); + [DllImport(SQLITE_DLL, ExactSpelling=true, EntryPoint = "sqlite3_db_config", CallingConvention = CALLING_CONVENTION)] public static extern unsafe int sqlite3_db_config_intptr_int_int(sqlite3 db, int op, IntPtr ptr, int int0, int int1); + [DllImport(SQLITE_DLL, ExactSpelling=true, EntryPoint = "sqlite3_db_config", CallingConvention = CALLING_CONVENTION)] + public static extern unsafe int sqlite3_db_config_intptr_int_int_arm64cc(sqlite3 db, int op, IntPtr dummy2, IntPtr dummy3, IntPtr dummy4, IntPtr dummy5, IntPtr dummy6, IntPtr dummy7, IntPtr ptr, int int0, int int1); + [DllImport(SQLITE_DLL, ExactSpelling=true, CallingConvention = CALLING_CONVENTION)] public static extern unsafe int sqlite3_create_collation(sqlite3 db, byte[] strName, int nType, hook_handle pvUser, NativeMethods.callback_collation func); diff --git a/src/SQLitePCLRaw.provider.sqlite3.uwp/Generated/provider_sqlite3.cs b/src/SQLitePCLRaw.provider.sqlite3.uwp/Generated/provider_sqlite3.cs index 1874edbf..27484549 100644 --- a/src/SQLitePCLRaw.provider.sqlite3.uwp/Generated/provider_sqlite3.cs +++ b/src/SQLitePCLRaw.provider.sqlite3.uwp/Generated/provider_sqlite3.cs @@ -36,6 +36,10 @@ public sealed class SQLite3Provider_sqlite3 : ISQLite3Provider { const CallingConvention CALLING_CONVENTION = CallingConvention.Cdecl; + static readonly bool IsArm64cc = + RuntimeInformation.ProcessArchitecture == Architecture.Arm64 && + (RuntimeInformation.IsOSPlatform(OSPlatform.OSX) || RuntimeInformation.IsOSPlatform(OSPlatform.Create("IOS"))); + string ISQLite3Provider.GetNativeLibraryName() { return "sqlite3"; @@ -512,6 +516,9 @@ int ISQLite3Provider.sqlite3_config(int op) int ISQLite3Provider.sqlite3_config(int op, int val) { + if (IsArm64cc) + return NativeMethods.sqlite3_config_int_arm64cc(op, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero, val); + return NativeMethods.sqlite3_config_int(op, val); } @@ -519,6 +526,9 @@ unsafe int ISQLite3Provider.sqlite3_db_config(sqlite3 db, int op, utf8z val) { fixed (byte* p_val = val) { + if (IsArm64cc) + return NativeMethods.sqlite3_db_config_charptr_arm64cc(db, op, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero, p_val); + return NativeMethods.sqlite3_db_config_charptr(db, op, p_val); } } @@ -526,7 +536,12 @@ unsafe int ISQLite3Provider.sqlite3_db_config(sqlite3 db, int op, utf8z val) unsafe int ISQLite3Provider.sqlite3_db_config(sqlite3 db, int op, int val, out int result) { int out_result = 0; - int native_result = NativeMethods.sqlite3_db_config_int_outint(db, op, val, &out_result); + int native_result; + + if (IsArm64cc) + native_result = NativeMethods.sqlite3_db_config_int_outint_arm64cc(db, op, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero, val, &out_result); + else + native_result = NativeMethods.sqlite3_db_config_int_outint(db, op, val, &out_result); result = out_result; @@ -535,6 +550,9 @@ unsafe int ISQLite3Provider.sqlite3_db_config(sqlite3 db, int op, int val, out i int ISQLite3Provider.sqlite3_db_config(sqlite3 db, int op, IntPtr ptr, int int0, int int1) { + if (IsArm64cc) + return NativeMethods.sqlite3_db_config_intptr_int_int_arm64cc(db, op, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero, ptr, int0, int1); + return NativeMethods.sqlite3_db_config_intptr_int_int(db, op, ptr, int0, int1); } @@ -692,8 +710,9 @@ int ISQLite3Provider.sqlite3_config_log(delegate_log func, object v) } var h = new hook_handle(hi); disp_log_hook_handle = h; // TODO if valid - var rc = NativeMethods.sqlite3_config_log(raw.SQLITE_CONFIG_LOG, cb, h); - return rc; + if (IsArm64cc) + return NativeMethods.sqlite3_config_log_arm64cc(raw.SQLITE_CONFIG_LOG, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero, cb, h); + return NativeMethods.sqlite3_config_log(raw.SQLITE_CONFIG_LOG, cb, h); } unsafe void ISQLite3Provider.sqlite3_log(int errcode, utf8z s) @@ -1752,18 +1771,33 @@ static class NativeMethods [DllImport(SQLITE_DLL, ExactSpelling=true, EntryPoint = "sqlite3_config", CallingConvention = CALLING_CONVENTION)] public static extern unsafe int sqlite3_config_int(int op, int val); + [DllImport(SQLITE_DLL, ExactSpelling=true, EntryPoint = "sqlite3_config", CallingConvention = CALLING_CONVENTION)] + public static extern unsafe int sqlite3_config_int_arm64cc(int op, IntPtr dummy1, IntPtr dummy2, IntPtr dummy3, IntPtr dummy4, IntPtr dummy5, IntPtr dummy6, IntPtr dummy7, int val); + [DllImport(SQLITE_DLL, ExactSpelling=true, EntryPoint = "sqlite3_config", CallingConvention = CALLING_CONVENTION)] public static extern unsafe int sqlite3_config_log(int op, NativeMethods.callback_log func, hook_handle pvUser); + [DllImport(SQLITE_DLL, ExactSpelling=true, EntryPoint = "sqlite3_config", CallingConvention = CALLING_CONVENTION)] + public static extern unsafe int sqlite3_config_log_arm64cc(int op, IntPtr dummy1, IntPtr dummy2, IntPtr dummy3, IntPtr dummy4, IntPtr dummy5, IntPtr dummy6, IntPtr dummy7, NativeMethods.callback_log func, hook_handle pvUser); + [DllImport(SQLITE_DLL, ExactSpelling=true, EntryPoint = "sqlite3_db_config", CallingConvention = CALLING_CONVENTION)] public static extern unsafe int sqlite3_db_config_charptr(sqlite3 db, int op, byte* val); + [DllImport(SQLITE_DLL, ExactSpelling=true, EntryPoint = "sqlite3_db_config", CallingConvention = CALLING_CONVENTION)] + public static extern unsafe int sqlite3_db_config_charptr_arm64cc(sqlite3 db, int op, IntPtr dummy2, IntPtr dummy3, IntPtr dummy4, IntPtr dummy5, IntPtr dummy6, IntPtr dummy7, byte* val); + [DllImport(SQLITE_DLL, ExactSpelling=true, EntryPoint = "sqlite3_db_config", CallingConvention = CALLING_CONVENTION)] public static extern unsafe int sqlite3_db_config_int_outint(sqlite3 db, int op, int val, int* result); + [DllImport(SQLITE_DLL, ExactSpelling=true, EntryPoint = "sqlite3_db_config", CallingConvention = CALLING_CONVENTION)] + public static extern unsafe int sqlite3_db_config_int_outint_arm64cc(sqlite3 db, int op, IntPtr dummy2, IntPtr dummy3, IntPtr dummy4, IntPtr dummy5, IntPtr dummy6, IntPtr dummy7, int val, int* result); + [DllImport(SQLITE_DLL, ExactSpelling=true, EntryPoint = "sqlite3_db_config", CallingConvention = CALLING_CONVENTION)] public static extern unsafe int sqlite3_db_config_intptr_int_int(sqlite3 db, int op, IntPtr ptr, int int0, int int1); + [DllImport(SQLITE_DLL, ExactSpelling=true, EntryPoint = "sqlite3_db_config", CallingConvention = CALLING_CONVENTION)] + public static extern unsafe int sqlite3_db_config_intptr_int_int_arm64cc(sqlite3 db, int op, IntPtr dummy2, IntPtr dummy3, IntPtr dummy4, IntPtr dummy5, IntPtr dummy6, IntPtr dummy7, IntPtr ptr, int int0, int int1); + [DllImport(SQLITE_DLL, ExactSpelling=true, CallingConvention = CALLING_CONVENTION)] public static extern unsafe int sqlite3_create_collation(sqlite3 db, byte[] strName, int nType, hook_handle pvUser, NativeMethods.callback_collation func); diff --git a/src/SQLitePCLRaw.provider.winsqlite3/Generated/provider_winsqlite3.cs b/src/SQLitePCLRaw.provider.winsqlite3/Generated/provider_winsqlite3.cs index 804a917a..c5131f57 100644 --- a/src/SQLitePCLRaw.provider.winsqlite3/Generated/provider_winsqlite3.cs +++ b/src/SQLitePCLRaw.provider.winsqlite3/Generated/provider_winsqlite3.cs @@ -36,6 +36,10 @@ public sealed class SQLite3Provider_winsqlite3 : ISQLite3Provider { const CallingConvention CALLING_CONVENTION = CallingConvention.StdCall; + static readonly bool IsArm64cc = + RuntimeInformation.ProcessArchitecture == Architecture.Arm64 && + (RuntimeInformation.IsOSPlatform(OSPlatform.OSX) || RuntimeInformation.IsOSPlatform(OSPlatform.Create("IOS"))); + string ISQLite3Provider.GetNativeLibraryName() { return "winsqlite3"; @@ -512,6 +516,9 @@ int ISQLite3Provider.sqlite3_config(int op) int ISQLite3Provider.sqlite3_config(int op, int val) { + if (IsArm64cc) + return NativeMethods.sqlite3_config_int_arm64cc(op, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero, val); + return NativeMethods.sqlite3_config_int(op, val); } @@ -519,6 +526,9 @@ unsafe int ISQLite3Provider.sqlite3_db_config(sqlite3 db, int op, utf8z val) { fixed (byte* p_val = val) { + if (IsArm64cc) + return NativeMethods.sqlite3_db_config_charptr_arm64cc(db, op, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero, p_val); + return NativeMethods.sqlite3_db_config_charptr(db, op, p_val); } } @@ -526,7 +536,12 @@ unsafe int ISQLite3Provider.sqlite3_db_config(sqlite3 db, int op, utf8z val) unsafe int ISQLite3Provider.sqlite3_db_config(sqlite3 db, int op, int val, out int result) { int out_result = 0; - int native_result = NativeMethods.sqlite3_db_config_int_outint(db, op, val, &out_result); + int native_result; + + if (IsArm64cc) + native_result = NativeMethods.sqlite3_db_config_int_outint_arm64cc(db, op, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero, val, &out_result); + else + native_result = NativeMethods.sqlite3_db_config_int_outint(db, op, val, &out_result); result = out_result; @@ -535,6 +550,9 @@ unsafe int ISQLite3Provider.sqlite3_db_config(sqlite3 db, int op, int val, out i int ISQLite3Provider.sqlite3_db_config(sqlite3 db, int op, IntPtr ptr, int int0, int int1) { + if (IsArm64cc) + return NativeMethods.sqlite3_db_config_intptr_int_int_arm64cc(db, op, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero, ptr, int0, int1); + return NativeMethods.sqlite3_db_config_intptr_int_int(db, op, ptr, int0, int1); } @@ -692,8 +710,9 @@ int ISQLite3Provider.sqlite3_config_log(delegate_log func, object v) } var h = new hook_handle(hi); disp_log_hook_handle = h; // TODO if valid - var rc = NativeMethods.sqlite3_config_log(raw.SQLITE_CONFIG_LOG, cb, h); - return rc; + if (IsArm64cc) + return NativeMethods.sqlite3_config_log_arm64cc(raw.SQLITE_CONFIG_LOG, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero, cb, h); + return NativeMethods.sqlite3_config_log(raw.SQLITE_CONFIG_LOG, cb, h); } unsafe void ISQLite3Provider.sqlite3_log(int errcode, utf8z s) @@ -1752,18 +1771,33 @@ static class NativeMethods [DllImport(SQLITE_DLL, ExactSpelling=true, EntryPoint = "sqlite3_config", CallingConvention = CALLING_CONVENTION)] public static extern unsafe int sqlite3_config_int(int op, int val); + [DllImport(SQLITE_DLL, ExactSpelling=true, EntryPoint = "sqlite3_config", CallingConvention = CALLING_CONVENTION)] + public static extern unsafe int sqlite3_config_int_arm64cc(int op, IntPtr dummy1, IntPtr dummy2, IntPtr dummy3, IntPtr dummy4, IntPtr dummy5, IntPtr dummy6, IntPtr dummy7, int val); + [DllImport(SQLITE_DLL, ExactSpelling=true, EntryPoint = "sqlite3_config", CallingConvention = CALLING_CONVENTION)] public static extern unsafe int sqlite3_config_log(int op, NativeMethods.callback_log func, hook_handle pvUser); + [DllImport(SQLITE_DLL, ExactSpelling=true, EntryPoint = "sqlite3_config", CallingConvention = CALLING_CONVENTION)] + public static extern unsafe int sqlite3_config_log_arm64cc(int op, IntPtr dummy1, IntPtr dummy2, IntPtr dummy3, IntPtr dummy4, IntPtr dummy5, IntPtr dummy6, IntPtr dummy7, NativeMethods.callback_log func, hook_handle pvUser); + [DllImport(SQLITE_DLL, ExactSpelling=true, EntryPoint = "sqlite3_db_config", CallingConvention = CALLING_CONVENTION)] public static extern unsafe int sqlite3_db_config_charptr(sqlite3 db, int op, byte* val); + [DllImport(SQLITE_DLL, ExactSpelling=true, EntryPoint = "sqlite3_db_config", CallingConvention = CALLING_CONVENTION)] + public static extern unsafe int sqlite3_db_config_charptr_arm64cc(sqlite3 db, int op, IntPtr dummy2, IntPtr dummy3, IntPtr dummy4, IntPtr dummy5, IntPtr dummy6, IntPtr dummy7, byte* val); + [DllImport(SQLITE_DLL, ExactSpelling=true, EntryPoint = "sqlite3_db_config", CallingConvention = CALLING_CONVENTION)] public static extern unsafe int sqlite3_db_config_int_outint(sqlite3 db, int op, int val, int* result); + [DllImport(SQLITE_DLL, ExactSpelling=true, EntryPoint = "sqlite3_db_config", CallingConvention = CALLING_CONVENTION)] + public static extern unsafe int sqlite3_db_config_int_outint_arm64cc(sqlite3 db, int op, IntPtr dummy2, IntPtr dummy3, IntPtr dummy4, IntPtr dummy5, IntPtr dummy6, IntPtr dummy7, int val, int* result); + [DllImport(SQLITE_DLL, ExactSpelling=true, EntryPoint = "sqlite3_db_config", CallingConvention = CALLING_CONVENTION)] public static extern unsafe int sqlite3_db_config_intptr_int_int(sqlite3 db, int op, IntPtr ptr, int int0, int int1); + [DllImport(SQLITE_DLL, ExactSpelling=true, EntryPoint = "sqlite3_db_config", CallingConvention = CALLING_CONVENTION)] + public static extern unsafe int sqlite3_db_config_intptr_int_int_arm64cc(sqlite3 db, int op, IntPtr dummy2, IntPtr dummy3, IntPtr dummy4, IntPtr dummy5, IntPtr dummy6, IntPtr dummy7, IntPtr ptr, int int0, int int1); + [DllImport(SQLITE_DLL, ExactSpelling=true, CallingConvention = CALLING_CONVENTION)] public static extern unsafe int sqlite3_create_collation(sqlite3 db, byte[] strName, int nType, hook_handle pvUser, NativeMethods.callback_collation func); diff --git a/src/common/tests_xunit.cs b/src/common/tests_xunit.cs index eda7e811..48c834c8 100644 --- a/src/common/tests_xunit.cs +++ b/src/common/tests_xunit.cs @@ -814,6 +814,10 @@ public void test_sqlite3_memory() [Fact] public void test_sqlite3_soft_heap_limit64() { + // Skip failing test on windows system provided winsqlite3 + if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows) && raw.GetNativeLibraryName() == "winsqlite3") + return; + var query = raw.sqlite3_soft_heap_limit64(-1); Assert.True(query >= 0);