aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Framework/Util.cs
diff options
context:
space:
mode:
authorJustin Clark-Casey (justincc)2012-02-18 00:33:52 +0000
committerJustin Clark-Casey (justincc)2012-02-18 00:33:52 +0000
commitb817c337dc2c5d8efda710f445114aa9a9344611 (patch)
tree4ff5ef565c57495fa89e051504983117413d8cee /OpenSim/Framework/Util.cs
parentFillin missing SQLite support for Telehubs (diff)
downloadopensim-SC_OLD-b817c337dc2c5d8efda710f445114aa9a9344611.zip
opensim-SC_OLD-b817c337dc2c5d8efda710f445114aa9a9344611.tar.gz
opensim-SC_OLD-b817c337dc2c5d8efda710f445114aa9a9344611.tar.bz2
opensim-SC_OLD-b817c337dc2c5d8efda710f445114aa9a9344611.tar.xz
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.
Diffstat (limited to 'OpenSim/Framework/Util.cs')
-rw-r--r--OpenSim/Framework/Util.cs38
1 files changed, 37 insertions, 1 deletions
diff --git a/OpenSim/Framework/Util.cs b/OpenSim/Framework/Util.cs
index 4b0b13c..b3ec5c2 100644
--- a/OpenSim/Framework/Util.cs
+++ b/OpenSim/Framework/Util.cs
@@ -35,7 +35,8 @@ using System.IO;
35using System.IO.Compression; 35using System.IO.Compression;
36using System.Net; 36using System.Net;
37using System.Net.Sockets; 37using System.Net.Sockets;
38using System.Reflection; 38using System.Reflection;
39using System.Runtime.InteropServices;
39using System.Runtime.Serialization; 40using System.Runtime.Serialization;
40using System.Runtime.Serialization.Formatters.Binary; 41using System.Runtime.Serialization.Formatters.Binary;
41using System.Security.Cryptography; 42using System.Security.Cryptography;
@@ -375,6 +376,20 @@ namespace OpenSim.Framework
375 } 376 }
376 377
377 return sb.ToString(); 378 return sb.ToString();
379 }
380
381 /// <summary>
382 /// Is the platform Windows?
383 /// </summary>
384 /// <returns>true if so, false otherwise</returns>
385 public static bool IsWindows()
386 {
387 PlatformID platformId = Environment.OSVersion.Platform;
388
389 return (platformId == PlatformID.Win32NT
390 || platformId == PlatformID.Win32S
391 || platformId == PlatformID.Win32Windows
392 || platformId == PlatformID.WinCE);
378 } 393 }
379 394
380 public static bool IsEnvironmentSupported(ref string reason) 395 public static bool IsEnvironmentSupported(ref string reason)
@@ -1457,6 +1472,27 @@ namespace OpenSim.Framework
1457 } 1472 }
1458 1473
1459 return data; 1474 return data;
1475 }
1476
1477 /// <summary>
1478 /// Used to trigger an early library load on Windows systems.
1479 /// </summary>
1480 /// <remarks>
1481 /// Required to get 32-bit and 64-bit processes to automatically use the
1482 /// appropriate native library.
1483 /// </remarks>
1484 /// <param name="dllToLoad"></param>
1485 /// <returns></returns>
1486 [DllImport("kernel32.dll")]
1487 public static extern IntPtr LoadLibrary(string dllToLoad);
1488
1489 /// <summary>
1490 /// Determine whether the current process is 64 bit
1491 /// </summary>
1492 /// <returns>true if so, false if not</returns>
1493 public static bool Is64BitProcess()
1494 {
1495 return IntPtr.Size == 8;
1460 } 1496 }
1461 1497
1462 #region FireAndForget Threading Pattern 1498 #region FireAndForget Threading Pattern