Skip to content
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

Unity Mono Support? #347

Open
AmirMahdiNassiri opened this issue May 23, 2020 · 4 comments
Open

Unity Mono Support? #347

AmirMahdiNassiri opened this issue May 23, 2020 · 4 comments

Comments

@AmirMahdiNassiri
Copy link

First of all many thanks for your amazing libraries. I'm using them in my WPF .Net Core apps as well as Xamarin apps.

Right now I'm trying to import one of my class libraries targeted for .Net Standard 2.0 which uses your libraries and Microsoft.EntityFrameworkCore.Sqlite as well.

I'm getting this error:

System.DllNotFoundException: e_sqlite3 at (wrapper managed-to-native) SQLitePCL.SQLite3Provider_e_sqlite3+NativeMethods.sqlite3_libversion_number() at SQLitePCL.SQLite3Provider_e_sqlite3.SQLitePCL.ISQLite3Provider.sqlite3_libversion_number () at SQLitePCL.raw.SetProvider (SQLitePCL.ISQLite3Provider imp) at SQLitePCL.Batteries_V2.Init ()

I'm assuming that there is no native wrapper for Unity runtime Mono. Is that right?

Is there any way that we can get it set up for use in Unity?

Any help is deeply appreciated.

@bricelam
Copy link
Contributor

Sounds like e_sqlite3.dll isn't getting copied to the output directory. You might need to copy some of the logic from SQLitePCLRaw.lib.e_sqlite3.targets into your project.

@bricelam
Copy link
Contributor

After installing the package with NuGetForUnity, I had to manually include the native assets and specify their platform settings, but I was able to get it working.

image

SQLitePCL.Batteries_V2.Init();
GetComponent<Text>().text = SQLitePCL.raw.sqlite3_libversion().utf8_to_string();

@Sahasrara
Copy link

Sahasrara commented Oct 17, 2022

@bricelam I'd like to replicate what you've done. Would you mind sharing where you download the native assets?

I get:

Exception: Library e_sqlite3 not found
plat: dlopen
suffix: DYLIB
possibilities (2):
    1) /Users/eric/Documents/DialogueEditor/Assets/Packages/SQLitePCLRaw.core.2.1.2/lib/netstandard2.0/runtimes/osx-x64/native/libe_sqlite3.dylib
    2) /Users/eric/Documents/DialogueEditor/Assets/Packages/SQLitePCLRaw.core.2.1.2/lib/netstandard2.0/libe_sqlite3.dylib
dlopen TryLoad: /Users/eric/Documents/DialogueEditor/Assets/Packages/SQLitePCLRaw.core.2.1.2/lib/netstandard2.0/runtimes/osx-x64/native/libe_sqlite3.dylib
dlopen gave: 0
dlopen TryLoad: /Users/eric/Documents/DialogueEditor/Assets/Packages/SQLitePCLRaw.core.2.1.2/lib/netstandard2.0/libe_sqlite3.dylib
dlopen gave: 0
NOT FOUND

SQLitePCL.NativeLibrary.Load (System.String libraryName, System.Reflection.Assembly assy, System.Int32 flags) (at <8a9cf65dcc6542b59d3abc28e58f9815>:0)
SQLitePCL.Batteries_V2.MakeDynamic (System.String name, System.Int32 flags) (at <8a9cf65dcc6542b59d3abc28e58f9815>:0)
SQLitePCL.Batteries_V2.DoDynamic_cdecl (System.String name, System.Int32 flags) (at <8a9cf65dcc6542b59d3abc28e58f9815>:0)
SQLitePCL.Batteries_V2.Init () (at <8a9cf65dcc6542b59d3abc28e58f9815>:0)

@bricelam
Copy link
Contributor

I think they were downloaded by NuGetForUnity. Make sure you're looking under the SQLitePCL.lib directory. If they're not downloaded, you can download and extract the package from nuget.org (It's just a zip file with .nupkg for its extension.)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants