Skip to content

Commit 7c231fd

Browse files
authored
Merge pull request #10 from gilzoide/bugfix/webgl-minimal-stripping
Fix IL2CPP builds with managed stripping level set to Minimal
2 parents 8afeb39 + 9275b59 commit 7c231fd

File tree

5 files changed

+18
-3
lines changed

5 files changed

+18
-3
lines changed

.editorconfig

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ root = true
33
[*]
44
end_of_line = lf
55
charset = utf-8
6+
insert_final_newline = true
67

78
[*.{asmdef,cs}]
89
indent_style = space

Plugins/tools~/fix-library-path.sed

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,17 @@
1414
#endif
1515
}
1616

17+
# Fix constrain `sqlite3_win32*` functions to Windows only
18+
# This avoids breaking IL2CPP builds with managed stripping level set to Minimal
19+
/sqlite3_win32_/ {
20+
i\
21+
#if UNITY_EDITOR_WIN || UNITY_STANDALONE_WIN
22+
n
23+
a\
24+
#endif
25+
}
26+
27+
1728
# Make Quote function public, for libraries making raw queries
1829
s/static string Quote/public static string Quote/
1930

README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,4 +102,5 @@ public class TestSQLite : MonoBehaviour
102102
- `LibraryPath` is made public.
103103
This is useful for libraries that want to bind additional native SQLite functions via P/Invoke.
104104
- `SQLiteConnection.Quote` is made public.
105-
This is be useful for libraries making raw queries.
105+
This is be useful for libraries making raw queries.
106+
- `SQLite3.SetDirectory` is only defined in Windows platforms.

Runtime/SQLiteConfig.Log.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
#if UNITY_EDITOR || !UNITY_WEBGL
12
using System;
23
using System.Runtime.InteropServices;
34
using AOT;
@@ -26,12 +27,11 @@ internal static void SQLiteLogCallback(IntPtr userdata, Result resultCode, IntPt
2627
}
2728
}
2829

29-
#if UNITY_EDITOR || !UNITY_WEBGL
3030
static SQLite3()
3131
{
3232
const int SQLITE_CONFIG_LOG = 16; /* xFunc, void* */
3333
Config(SQLITE_CONFIG_LOG, Marshal.GetFunctionPointerForDelegate<SQLiteLogCallbackDelegate>(SQLiteLogCallback), IntPtr.Zero);
3434
}
35-
#endif
3635
}
3736
}
37+
#endif

Runtime/sqlite-net/SQLite.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4482,8 +4482,10 @@ public enum ConfigOption : int
44824482
[DllImport(LibraryPath, EntryPoint = "sqlite3_config", CallingConvention=CallingConvention.Cdecl)]
44834483
public static extern Result Config (ConfigOption option);
44844484

4485+
#if UNITY_EDITOR_WIN || UNITY_STANDALONE_WIN
44854486
[DllImport(LibraryPath, EntryPoint = "sqlite3_win32_set_directory", CallingConvention=CallingConvention.Cdecl, CharSet=CharSet.Unicode)]
44864487
public static extern int SetDirectory (uint directoryType, string directoryPath);
4488+
#endif
44874489

44884490
[DllImport(LibraryPath, EntryPoint = "sqlite3_busy_timeout", CallingConvention=CallingConvention.Cdecl)]
44894491
public static extern Result BusyTimeout (IntPtr db, int milliseconds);

0 commit comments

Comments
 (0)