From b817c337dc2c5d8efda710f445114aa9a9344611 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Sat, 18 Feb 2012 00:33:52 +0000 Subject: On Windows automatically load the correct native ODE library depending on whether the process is 32-bit or 64-bit In theory, this means that a 64-bit Windows OS user can now run OpenSim.exe with ODE and use more than 2 (or 3) GB of memory. However, this is completely untested since I don't currently own a 64-bit Windows box. Feedback appreciated. Using OpenSim.32BitLaunch.exe should continue to work. Other platforms are unaffected. This will currently not work with sqlite - I will add that too if this works. --- .../Region/Physics/Manager/PhysicsPluginManager.cs | 3 ++- OpenSim/Region/Physics/OdePlugin/OdePlugin.cs | 24 ++++++++++++++++++++-- 2 files changed, 24 insertions(+), 3 deletions(-) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/Physics/Manager/PhysicsPluginManager.cs b/OpenSim/Region/Physics/Manager/PhysicsPluginManager.cs index 3763696..8587a2b 100644 --- a/OpenSim/Region/Physics/Manager/PhysicsPluginManager.cs +++ b/OpenSim/Region/Physics/Manager/PhysicsPluginManager.cs @@ -30,7 +30,8 @@ using System.Collections.Generic; using System.IO; using System.Reflection; using Nini.Config; -using log4net; +using log4net; +using OpenSim.Framework; namespace OpenSim.Region.Physics.Manager { diff --git a/OpenSim/Region/Physics/OdePlugin/OdePlugin.cs b/OpenSim/Region/Physics/OdePlugin/OdePlugin.cs index 716161a..6ee2714 100644 --- a/OpenSim/Region/Physics/OdePlugin/OdePlugin.cs +++ b/OpenSim/Region/Physics/OdePlugin/OdePlugin.cs @@ -46,7 +46,7 @@ namespace OpenSim.Region.Physics.OdePlugin /// public class OdePlugin : IPhysicsPlugin { - //private static readonly log4net.ILog m_log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); + private static readonly log4net.ILog m_log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); private OdeScene m_scene; @@ -59,13 +59,33 @@ namespace OpenSim.Region.Physics.OdePlugin { if (m_scene == null) { + // We do this so that OpenSimulator on Windows loads the correct native ODE 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 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); + Util.LoadLibrary(nativeLibraryPath); + } + // 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). d.InitODE(); m_scene = new OdeScene(sceneIdentifier); } - return (m_scene); + + return m_scene; } public string GetName() -- cgit v1.1