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/Framework/Util.cs | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) (limited to 'OpenSim/Framework/Util.cs') 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) -- cgit v1.1