about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorptitSeb <sebastien.chev@gmail.com>2022-06-11 13:40:54 +0200
committerptitSeb <sebastien.chev@gmail.com>2022-06-11 13:40:54 +0200
commit7ac8d7de2222cd37671d7c25f363dfa2207d5ee9 (patch)
treeb8200331100105f93f4b61895efc290ddd587bfa
parentf012e02b3541c8c2c5389b8fc97f618cded58572 (diff)
downloadbox64-7ac8d7de2222cd37671d7c25f363dfa2207d5ee9.tar.gz
box64-7ac8d7de2222cd37671d7c25f363dfa2207d5ee9.zip
Added support to load different libs with same name from different folders (for #299)
-rwxr-xr-xsrc/librarian/library.c13
1 files changed, 9 insertions, 4 deletions
diff --git a/src/librarian/library.c b/src/librarian/library.c
index e1360a8b..0ef65a3a 100755
--- a/src/librarian/library.c
+++ b/src/librarian/library.c
@@ -363,7 +363,7 @@ library_t *NewLibrary(const char* path, box64context_t* context)
     int essential = isEssentialLib(lib->name);
     if(!notwrapped && box64_prefer_emulated && !essential)
         notwrapped = 1;
-    int precise = (!box64_prefer_wrapped && !essential && path && path[0]=='/')?1:0;
+    int precise = (!box64_prefer_wrapped && !essential && path && strchr(path, '/'))?1:0;
     if(!notwrapped && precise && strstr(path, "libtcmalloc_minimal.so"))
         precise = 0;    // allow native version for tcmalloc_minimum
     // check if name is libSDL_sound-1.0.so.1 but with SDL2 loaded, then try emulated first...
@@ -553,9 +553,14 @@ int IsSameLib(library_t* lib, const char* path)
     if(!lib) 
         return 0;
     char* name = Path2Name(path);
-    if(strcmp(name, lib->name)==0)
-        ret=1;
-    else {
+    if((!strchr(path, '/') || lib->type==0)) {
+        if(strcmp(name, lib->name)==0)
+            ret=1;
+    } else {
+        if(!strcmp(path, lib->path))
+            ret=1;
+    }
+    if(!ret) {
         int n = NbDot(name);
         if(n>=0 && n<lib->nbdot)
             if(strncmp(name, lib->name, strlen(name))==0)