简体   繁体   中英

Need 64-bit SQLite DLL for managed C# application

I'm trying to embed SQLite into my portable C# .NET 2.0 application rather than having the DLL files included in the distribution folder. However, to embed SQLite, I cannot use the Mixed-Mode libraries provided by PHXSoftware. Instead, I am using their 'Managed Only' version.

This works fine on 32-bit computers, but when it's running on a 64-bit machine, it throws a format exception. As I found out from here: http://sqlite.phxsoftware.com/forums/p/2564/9939.aspx I need to load the unmanaged sqlite3.dll manually in the required architecture format first before I use the managed libraries.

That's where I fall short. I cannot find a 64-bit version of SQLite to include along with the 32-bit one. Can anyone help? Dare I say, does anyone have any better ideas?

I'd recommend you build the source yourself. It's very straight-forward to do. Especially considering Sqlite offers amalgamation source .

Here are the compiler pre-processor defines I use for a 64-bit release build:

  • WIN64 NDEBUG
  • _WINDOWS
  • _USRDLL
  • NO_TCL
  • _CRT_SECURE_NO_DEPRECATE
  • THREADSAFE=1
  • TEMP_STORE=1
  • SQLITE_MAX_EXPR_DEPTH=0

Here are the compiler pre-processor defines I use for a 32-bit release build:

  • WIN32
  • NDEBUG
  • _WINDOWS
  • _USRDLL
  • NO_TCL
  • _CRT_SECURE_NO_DEPRECATE
  • THREADSAFE=1
  • TEMP_STORE=1
  • SQLITE_MAX_EXPR_DEPTH=0

The System.Data.SQLite fork has x86/x64 binaries for .Net 2, 3.5, and 4. Downloads are here .

Update:

Another possible solution is to target your application for x86 platform and just use the x86 SQLite libraries. If your application doesn't require x64 features targeting the x86 platform will greatly reduce the complexity of your deployment.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM