New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Question: Unity Support #1023
Comments
diff --git a/src/SQLite.cs b/src/SQLite.cs
--- a/src/SQLite.cs (date 1618732310971)
+++ b/src/SQLite.cs (date 1618732310971)
@@ -4356,7 +4356,11 @@
Serialized = 3
}
+#if UNITY_ANDROID && !UNITY_EDITOR
+ const string LibraryPath = "sqliteX";
+#else
const string LibraryPath = "sqlite3";
+#endif
#if !USE_CSHARP_SQLITE && !USE_WP8_NATIVE_SQLITE && !USE_SQLITEPCL_RAW
[DllImport(LibraryPath, EntryPoint = "sqlite3_threadsafe", CallingConvention=CallingConvention.Cdecl)] |
Hey @shiena, can you please explain, or send some information how SQLite works on Mac/iOS? Why the native library is not necessary? |
@khindemit |
Just to add a comment after doing some research - on macOS, if the library asked for in sqlite-net is "sqlite3" macOS will automatically look for a library with libsqlite3.dylib, which is included in the library lookup path by default. The lib prefix and .dylib are magic strings added to the lookup. |
Even more magic - I just checked my macOS Monterey 12.0.1 M1 install, and it's now /usr/lib/sqlite3 alone. Interesting. |
I forgot that DllImport should be diff --git a/src/SQLite.cs b/src/SQLite.cs
index e5712f3..dc9e0d4 100644
--- a/src/SQLite.cs
+++ b/src/SQLite.cs
@@ -4468,7 +4468,13 @@ namespace SQLite
Serialized = 3
}
+#if UNITY_IOS && !UNITY_EDITOR
+ const string LibraryPath = "__Internal";
+#elif UNITY_ANDROID && !UNITY_EDITOR
+ const string LibraryPath = "sqliteX";
+#else
const string LibraryPath = "sqlite3";
+#endif
#if !USE_CSHARP_SQLITE && !USE_WP8_NATIVE_SQLITE && !USE_SQLITEPCL_RAW
[DllImport(LibraryPath, EntryPoint = "sqlite3_threadsafe", CallingConvention=CallingConvention.Cdecl)] |
@shiena |
Hi!
Could the SQLite-net be used in Unity projects?
In the official description Unity not mentioned.
But I see a merged fix for IL2CPP:
#993
The text was updated successfully, but these errors were encountered: