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

Commits to the Asterisk SCF project code repositories asterisk-scf-commits at lists.digium.com
Mon Jun 20 17:02:32 CDT 2011


branch "review/icebox-lib-path" has been created
        at  1168894d00ddeb4aed652df4ce21227e124d64bb (commit)

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

    Changes the dynamic library (module) loader to allow fully-specified
    paths to modules to be loaded, in addition to supporting simple filenames
    that will be located along standard library search paths.

diff --git a/cpp/src/Ice/DynamicLibrary.cpp b/cpp/src/Ice/DynamicLibrary.cpp
index 031d994..417503a 100644
--- a/cpp/src/Ice/DynamicLibrary.cpp
+++ b/cpp/src/Ice/DynamicLibrary.cpp
@@ -48,10 +48,14 @@ IceInternal::DynamicLibrary::~DynamicLibrary()
 IceInternal::DynamicLibrary::symbol_type
 IceInternal::DynamicLibrary::loadEntryPoint(const string& entryPoint, bool useIceVersion)
 {
+    // entryPoint format: [libPath@]libName[,version]:funcName
     string::size_type colon = entryPoint.rfind(':');
     string::size_type comma = entryPoint.find(',');
+    string::size_type at = entryPoint.find('@');
     if(colon == string::npos || colon == entryPoint.size() - 1 ||
-        (comma != string::npos && (comma > colon || comma == colon - 1)))
+        (comma != string::npos && (comma > colon || comma == colon - 1)) ||
+        (at != string::npos && (at >= colon - 1 ||
+            (comma != string::npos && at >= comma - 1))))
     {
         _err = "invalid entry point format `" + entryPoint + "'";
         return 0;
@@ -87,10 +91,23 @@ IceInternal::DynamicLibrary::loadEntryPoint(const string& entryPoint, bool useIc
         version = libSpec.substr(comma + 1);
     }
 
-    string lib;
+    string lib, libPath;
+
+    if (at != string::npos)
+    {
+        libPath = libName.substr(0, at) + '/';
+        libName = libName.substr(at + 1);
+    }
+
 
 #ifdef _WIN32
-    lib = libName;
+    // convert forward slash to back slash
+    string::size_type slash;
+    while ((slash = libPath.find('/')) != string::npos)
+    {
+        libPath.replace(slash, 1, 1, '\\');
+    }
+    lib = libPath + libName;
 
 #   ifdef COMPSUFFIX
     //
@@ -112,14 +129,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 +146,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/integration/ice.git



More information about the asterisk-scf-commits mailing list