[asterisk-scf-commits] asterisk-scf/release/ice.git branch "icebox-lib-path" created.

Commits to the Asterisk SCF project code repositories asterisk-scf-commits at lists.digium.com
Tue Sep 28 15:43:40 CDT 2010


branch "icebox-lib-path" has been created
        at  4a8ee9d55fa972dec7700303697c3842a9b3a27e (commit)

- Log -----------------------------------------------------------------
commit 4a8ee9d55fa972dec7700303697c3842a9b3a27e
Author: David M. Lee <dlee at digium.com>
Date:   Tue Sep 28 13:32:42 2010 -0500

    Add path to lib name

diff --git a/cpp/src/Ice/DynamicLibrary.cpp b/cpp/src/Ice/DynamicLibrary.cpp
old mode 100644
new mode 100755
index c9be971..6e19cfe
--- a/cpp/src/Ice/DynamicLibrary.cpp
+++ b/cpp/src/Ice/DynamicLibrary.cpp
@@ -88,9 +88,31 @@ IceInternal::DynamicLibrary::loadEntryPoint(const string& entryPoint, bool useIc
     }
 
     string lib;
+    string libPath;
 
+    string::size_type lastSlash = libName.rfind('/');
 #ifdef _WIN32
-    lib = libName;
+    // on Windows, also search for backslash
+    if (lastSlash == string::npos)
+    {
+        lastSlash = libName.rfind('\\');
+    }
+#endif
+
+    if (lastSlash != string::npos)
+    {
+        libPath = libName.substr(0, lastSlash + 1);
+        libName = libName.substr(lastSlash + 1);
+    }
+
+
+#ifdef _WIN32
+    // convert forward slash to back slash
+    while ((string::size_type slash = libPath.find('/')) != string::npos)
+    {
+        libPath.replace(slash, '\\');
+    }
+    lib = libPath + libName;
 
 #   ifdef COMPSUFFIX
     //
@@ -112,14 +134,14 @@ IceInternal::DynamicLibrary::loadEntryPoint(const string& entryPoint, bool useIc
 
     lib += ".dll";
 #elif defined(__APPLE__)
-    lib = "lib" + libName;
+    lib = libPath + "lib" + libName;
     if(!version.empty()) 
     {
         lib += "." + version;
     }
     lib += ".dylib";
 #elif defined(__hpux)
-    lib = "lib" + libName;
+    lib = libPath + "lib" + libName;
     if(!version.empty())
     {
         lib += "." + version;
@@ -129,14 +151,14 @@ IceInternal::DynamicLibrary::loadEntryPoint(const string& entryPoint, bool useIc
         lib += ".sl";
     }
 #elif defined(_AIX)
-    lib = "lib" + libName + ".a(lib" + libName + ".so";
+    lib = libPath + "lib" + libName + ".a(lib" + libName + ".so";
     if(!version.empty())
     {
         lib += "." + version;
     }
     lib += ")";
 #else
-    lib = "lib" + libName + ".so";
+    lib = libPath + "lib" + libName + ".so";
     if(!version.empty())
     {
         lib += "." + version;

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


-- 
asterisk-scf/release/ice.git



More information about the asterisk-scf-commits mailing list