[asterisk-scf-commits] asterisk-scf/release/ice.git branch "fix-apple-so" created.

Commits to the Asterisk SCF project code repositories asterisk-scf-commits at lists.digium.com
Fri Mar 18 12:59:52 CDT 2011


branch "fix-apple-so" has been created
        at  a1c5db7561ca56ba69a6022c55a620cb0ee9ee6d (commit)

- Log -----------------------------------------------------------------
commit a1c5db7561ca56ba69a6022c55a620cb0ee9ee6d
Author: David M. Lee <dlee at digium.com>
Date:   Fri Mar 18 10:07:04 2011 -0500

    Improve fix-apple-so base on ZeroC feedback.
    
    * Try to load .dylib first, since that's how the most common Ice plugin,
      IceSSL, is built.
    * Attempt to load .bundle if .dylib and .so fail to load.
    * Updated the comment explaining the situation.
    * Collect errors from all three load attempts, rather than just
      displaying the first error.

diff --git a/cpp/src/Ice/DynamicLibrary.cpp b/cpp/src/Ice/DynamicLibrary.cpp
index cbe3913..966508c 100644
--- a/cpp/src/Ice/DynamicLibrary.cpp
+++ b/cpp/src/Ice/DynamicLibrary.cpp
@@ -117,7 +117,7 @@ IceInternal::DynamicLibrary::loadEntryPoint(const string& entryPoint, bool useIc
     {
         lib += "." + version;
     }
-    lib += ".so"; // .so for loadable module on Mach-O
+    lib += ".dylib";
 #elif defined(__hpux)
     lib = "lib" + libName;
     if(!version.empty())
@@ -146,22 +146,26 @@ IceInternal::DynamicLibrary::loadEntryPoint(const string& entryPoint, bool useIc
     if(!load(lib))
     {
 #ifdef __APPLE__
-        string olderr = _err;
-        // Previous versions of Ice mistakenly loaded .dylib.  If it can't
-        // load a .so, fallback to loading a .dylib.  For more info on
-        // shared libraries (.dylib) vs. loadable modules (.so), see
-        // http://www.finkproject.org/doc/porting/shared.php
+        string allerr = _err;
+        // For Mac OS X, there is a distinction between shared libraries
+        // (.dylib) and loadable modules (usually .bundle or .so).  If we can't
+        // load as a shared library, try loading as a bundle.  For more info,
+        // see http://www.finkproject.org/doc/porting/shared.php
         lib = "lib" + libName;
         if(!version.empty())
         {
             lib += "." + version;
         }
-        lib += ".dylib";
-        if(!load(lib))
+        if(!load(lib + ".so"))
         {
-            // restore old error message
-            _err = olderr;
-            return 0;
+            allerr += "; " + _err;
+            if (!load(lib + ".bundle"))
+            {
+                // failed to load .dylib, .so and .bundle.
+                allerr += "; " + _err;
+                _err = allerr;
+                return 0;
+            }
         }
 #else
         return 0;

-----------------------------------------------------------------------


-- 
asterisk-scf/release/ice.git



More information about the asterisk-scf-commits mailing list