From 68a4ef5ef62aef3d5e1ec5c20b03b3b4fa51743b Mon Sep 17 00:00:00 2001
From: Justin Clark-Casey (justincc)
Date: Tue, 21 Feb 2012 02:52:20 +0000
Subject: Add 64 bit Windows sqlite3.dll and use this if running a 64-bit
windows process.
---
OpenSim/Data/SQLite/SQLiteAssetData.cs | 3 +++
OpenSim/Data/SQLite/SQLiteAuthenticationData.cs | 3 +++
OpenSim/Data/SQLite/SQLiteEstateData.cs | 3 +++
OpenSim/Data/SQLite/SQLiteFramework.cs | 2 ++
OpenSim/Data/SQLite/SQLiteInventoryStore.cs | 3 +++
OpenSim/Data/SQLite/SQLiteSimulationData.cs | 3 +++
OpenSim/Data/SQLite/SQLiteXInventoryData.cs | 3 +++
OpenSim/Framework/Util.cs | 30 ++++++++++++++++++++++++
OpenSim/Region/Physics/OdePlugin/OdePlugin.cs | 15 +-----------
bin/lib32/sqlite3.dll | Bin 0 -> 559244 bytes
bin/lib64/sqlite3.dll | Bin 0 -> 618496 bytes
bin/sqlite3.dll | Bin 559244 -> 0 bytes
12 files changed, 51 insertions(+), 14 deletions(-)
create mode 100755 bin/lib32/sqlite3.dll
create mode 100755 bin/lib64/sqlite3.dll
delete mode 100755 bin/sqlite3.dll
diff --git a/OpenSim/Data/SQLite/SQLiteAssetData.cs b/OpenSim/Data/SQLite/SQLiteAssetData.cs
index bb23fc1..d0e24c3 100644
--- a/OpenSim/Data/SQLite/SQLiteAssetData.cs
+++ b/OpenSim/Data/SQLite/SQLiteAssetData.cs
@@ -81,6 +81,9 @@ namespace OpenSim.Data.SQLite
/// connect string
override public void Initialise(string dbconnect)
{
+ if (Util.IsWindows())
+ Util.LoadArchSpecificWindowsDll("sqlite3.dll");
+
if (dbconnect == string.Empty)
{
dbconnect = "URI=file:Asset.db,version=3";
diff --git a/OpenSim/Data/SQLite/SQLiteAuthenticationData.cs b/OpenSim/Data/SQLite/SQLiteAuthenticationData.cs
index f51aa28..5120453 100644
--- a/OpenSim/Data/SQLite/SQLiteAuthenticationData.cs
+++ b/OpenSim/Data/SQLite/SQLiteAuthenticationData.cs
@@ -65,6 +65,9 @@ namespace OpenSim.Data.SQLite
if (!m_initialized)
{
+ if (Util.IsWindows())
+ Util.LoadArchSpecificWindowsDll("sqlite3.dll");
+
m_Connection = new SqliteConnection(connectionString);
m_Connection.Open();
diff --git a/OpenSim/Data/SQLite/SQLiteEstateData.cs b/OpenSim/Data/SQLite/SQLiteEstateData.cs
index 8db9262..c042ba2 100644
--- a/OpenSim/Data/SQLite/SQLiteEstateData.cs
+++ b/OpenSim/Data/SQLite/SQLiteEstateData.cs
@@ -69,6 +69,9 @@ namespace OpenSim.Data.SQLite
public void Initialise(string connectionString)
{
+ if (Util.IsWindows())
+ Util.LoadArchSpecificWindowsDll("sqlite3.dll");
+
m_connectionString = connectionString;
m_log.Info("[ESTATE DB]: Sqlite - connecting: "+m_connectionString);
diff --git a/OpenSim/Data/SQLite/SQLiteFramework.cs b/OpenSim/Data/SQLite/SQLiteFramework.cs
index 4992bcc..1594717 100644
--- a/OpenSim/Data/SQLite/SQLiteFramework.cs
+++ b/OpenSim/Data/SQLite/SQLiteFramework.cs
@@ -48,6 +48,8 @@ namespace OpenSim.Data.SQLite
protected SQLiteFramework(string connectionString)
{
+ if (Util.IsWindows())
+ Util.LoadArchSpecificWindowsDll("sqlite3.dll");
}
//////////////////////////////////////////////////////////////
diff --git a/OpenSim/Data/SQLite/SQLiteInventoryStore.cs b/OpenSim/Data/SQLite/SQLiteInventoryStore.cs
index 7dc07ec..ccbd154 100644
--- a/OpenSim/Data/SQLite/SQLiteInventoryStore.cs
+++ b/OpenSim/Data/SQLite/SQLiteInventoryStore.cs
@@ -77,6 +77,9 @@ namespace OpenSim.Data.SQLite
{
m_Initialized = true;
+ if (Util.IsWindows())
+ Util.LoadArchSpecificWindowsDll("sqlite3.dll");
+
if (dbconnect == string.Empty)
{
dbconnect = "URI=file:inventoryStore.db,version=3";
diff --git a/OpenSim/Data/SQLite/SQLiteSimulationData.cs b/OpenSim/Data/SQLite/SQLiteSimulationData.cs
index 6295113..186a586 100644
--- a/OpenSim/Data/SQLite/SQLiteSimulationData.cs
+++ b/OpenSim/Data/SQLite/SQLiteSimulationData.cs
@@ -110,6 +110,9 @@ namespace OpenSim.Data.SQLite
{
try
{
+ if (Util.IsWindows())
+ Util.LoadArchSpecificWindowsDll("sqlite3.dll");
+
m_connectionString = connectionString;
ds = new DataSet("Region");
diff --git a/OpenSim/Data/SQLite/SQLiteXInventoryData.cs b/OpenSim/Data/SQLite/SQLiteXInventoryData.cs
index 16f9046..1f36986 100644
--- a/OpenSim/Data/SQLite/SQLiteXInventoryData.cs
+++ b/OpenSim/Data/SQLite/SQLiteXInventoryData.cs
@@ -52,6 +52,9 @@ namespace OpenSim.Data.SQLite
public SQLiteXInventoryData(string conn, string realm)
{
+ if (Util.IsWindows())
+ Util.LoadArchSpecificWindowsDll("sqlite3.dll");
+
m_Folders = new SQLiteGenericTableHandler(
conn, "inventoryfolders", "XInventoryStore");
m_Items = new SqliteItemHandler(
diff --git a/OpenSim/Framework/Util.cs b/OpenSim/Framework/Util.cs
index b3ec5c2..efa4a7b 100644
--- a/OpenSim/Framework/Util.cs
+++ b/OpenSim/Framework/Util.cs
@@ -392,6 +392,36 @@ namespace OpenSim.Framework
|| platformId == PlatformID.WinCE);
}
+ public static bool LoadArchSpecificWindowsDll(string libraryName)
+ {
+ // We do this so that OpenSimulator on Windows loads the correct native library depending on whether
+ // it's running as a 32-bit process or a 64-bit one. By invoking LoadLibary here, later DLLImports
+ // will find it already loaded later on.
+ //
+ // This isn't necessary for other platforms (e.g. Mac OSX and Linux) since the DLL used can be
+ // controlled in config files.
+ string nativeLibraryPath;
+
+ if (Util.Is64BitProcess())
+ nativeLibraryPath = "lib64/" + libraryName;
+ else
+ nativeLibraryPath = "lib32/" + libraryName;
+
+ m_log.DebugFormat("[UTIL]: Loading native Windows library at {0}", nativeLibraryPath);
+
+ if (Util.LoadLibrary(nativeLibraryPath) == IntPtr.Zero)
+ {
+ m_log.ErrorFormat(
+ "[UTIL]: Couldn't find native Windows library at {0}", nativeLibraryPath);
+
+ return false;
+ }
+ else
+ {
+ return true;
+ }
+ }
+
public static bool IsEnvironmentSupported(ref string reason)
{
// Must have .NET 2.0 (Generics / libsl)
diff --git a/OpenSim/Region/Physics/OdePlugin/OdePlugin.cs b/OpenSim/Region/Physics/OdePlugin/OdePlugin.cs
index e8bb476..478dd95 100644
--- a/OpenSim/Region/Physics/OdePlugin/OdePlugin.cs
+++ b/OpenSim/Region/Physics/OdePlugin/OdePlugin.cs
@@ -66,20 +66,7 @@ namespace OpenSim.Region.Physics.OdePlugin
// This isn't necessary for other platforms (e.g. Mac OSX and Linux) since the DLL used can be
// controlled in Ode.NET.dll.config
if (Util.IsWindows())
- {
- string nativeLibraryPath;
-
- if (Util.Is64BitProcess())
- nativeLibraryPath = "lib64/ode.dll";
- else
- nativeLibraryPath = "lib32/ode.dll";
-
- m_log.DebugFormat("[ODE PLUGIN]: Loading native Windows ODE library at {0}", nativeLibraryPath);
-
- if (Util.LoadLibrary(nativeLibraryPath) == IntPtr.Zero)
- m_log.ErrorFormat(
- "[ODE PLUGIN]: Couldn't find native Windows ODE library at {0}", nativeLibraryPath);
- }
+ Util.LoadArchSpecificWindowsDll("ode.dll");
// Initializing ODE only when a scene is created allows alternative ODE plugins to co-habit (according to
// http://opensimulator.org/mantis/view.php?id=2750).
diff --git a/bin/lib32/sqlite3.dll b/bin/lib32/sqlite3.dll
new file mode 100755
index 0000000..f29dc62
Binary files /dev/null and b/bin/lib32/sqlite3.dll differ
diff --git a/bin/lib64/sqlite3.dll b/bin/lib64/sqlite3.dll
new file mode 100755
index 0000000..dadf7dd
Binary files /dev/null and b/bin/lib64/sqlite3.dll differ
diff --git a/bin/sqlite3.dll b/bin/sqlite3.dll
deleted file mode 100755
index f29dc62..0000000
Binary files a/bin/sqlite3.dll and /dev/null differ
--
cgit v1.1