diff options
Diffstat (limited to 'OpenSim/Framework')
-rw-r--r-- | OpenSim/Framework/Util.cs | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/OpenSim/Framework/Util.cs b/OpenSim/Framework/Util.cs index d2797e6..02da7f4 100644 --- a/OpenSim/Framework/Util.cs +++ b/OpenSim/Framework/Util.cs | |||
@@ -392,6 +392,36 @@ namespace OpenSim.Framework | |||
392 | || platformId == PlatformID.WinCE); | 392 | || platformId == PlatformID.WinCE); |
393 | } | 393 | } |
394 | 394 | ||
395 | public static bool LoadArchSpecificWindowsDll(string libraryName) | ||
396 | { | ||
397 | // We do this so that OpenSimulator on Windows loads the correct native library depending on whether | ||
398 | // it's running as a 32-bit process or a 64-bit one. By invoking LoadLibary here, later DLLImports | ||
399 | // will find it already loaded later on. | ||
400 | // | ||
401 | // This isn't necessary for other platforms (e.g. Mac OSX and Linux) since the DLL used can be | ||
402 | // controlled in config files. | ||
403 | string nativeLibraryPath; | ||
404 | |||
405 | if (Util.Is64BitProcess()) | ||
406 | nativeLibraryPath = "lib64/" + libraryName; | ||
407 | else | ||
408 | nativeLibraryPath = "lib32/" + libraryName; | ||
409 | |||
410 | m_log.DebugFormat("[UTIL]: Loading native Windows library at {0}", nativeLibraryPath); | ||
411 | |||
412 | if (Util.LoadLibrary(nativeLibraryPath) == IntPtr.Zero) | ||
413 | { | ||
414 | m_log.ErrorFormat( | ||
415 | "[UTIL]: Couldn't find native Windows library at {0}", nativeLibraryPath); | ||
416 | |||
417 | return false; | ||
418 | } | ||
419 | else | ||
420 | { | ||
421 | return true; | ||
422 | } | ||
423 | } | ||
424 | |||
395 | public static bool IsEnvironmentSupported(ref string reason) | 425 | public static bool IsEnvironmentSupported(ref string reason) |
396 | { | 426 | { |
397 | // Must have .NET 2.0 (Generics / libsl) | 427 | // Must have .NET 2.0 (Generics / libsl) |