about summary refs log tree commit diff stats
path: root/src/librarian
diff options
context:
space:
mode:
authorptitSeb <sebastien.chev@gmail.com>2023-04-15 16:18:55 +0200
committerptitSeb <sebastien.chev@gmail.com>2023-04-15 16:18:55 +0200
commitdd3ea0b5e6639e65b9e72e7fa0a36d162ccece1f (patch)
treeb99a6d0752d2d2e483662939db91de04768466d2 /src/librarian
parent4dbb1f6101b12a189a9c61c153c328b29889c6cf (diff)
downloadbox64-dd3ea0b5e6639e65b9e72e7fa0a36d162ccece1f.tar.gz
box64-dd3ea0b5e6639e65b9e72e7fa0a36d162ccece1f.zip
More fixes for dlclose/dlopen sequences
Diffstat (limited to 'src/librarian')
-rwxr-xr-xsrc/librarian/library.c11
-rwxr-xr-xsrc/librarian/library_private.h3
2 files changed, 13 insertions, 1 deletions
diff --git a/src/librarian/library.c b/src/librarian/library.c
index 109a11ba..085d954d 100755
--- a/src/librarian/library.c
+++ b/src/librarian/library.c
@@ -585,6 +585,9 @@ void Free1Library(library_t **lib, x64emu_t* emu)
             kh_destroy(symbol2map, (*lib)->w.symbol2map);
     }
 
+    // remove frim the dlopen collection
+    if((*lib)->dlopen)
+        RemoveDlopen(lib, (*lib)->dlopen);
     box_free(*lib);
     *lib = NULL;
 }
@@ -1135,4 +1138,10 @@ int GetRefCount(library_t* lib)
         default:
             return 0;
     }
-}
\ No newline at end of file
+}
+
+void SetDlOpenIdx(library_t* lib, int dlopen)
+{
+    if(lib)
+        lib->dlopen = dlopen;
+}
diff --git a/src/librarian/library_private.h b/src/librarian/library_private.h
index bb8188d8..d50da99e 100755
--- a/src/librarian/library_private.h
+++ b/src/librarian/library_private.h
@@ -74,6 +74,7 @@ typedef struct library_s {
     kh_bridgemap_t      *gbridgemap;    // global symbol bridgemap
     kh_bridgemap_t      *wbridgemap;    // weak symbol bridgemap
     kh_bridgemap_t      *lbridgemap;    // local symbol bridgemap
+    int                 dlopen;   // idx to the dlopen idx (or 0 if not dlopen)
 } library_t;
 
 // type for map elements
@@ -114,4 +115,6 @@ void removeLinkMapLib(library_t* lib);
 int FiniLibrary(library_t* lib, x64emu_t* emu);
 void Free1Library(library_t **lib, x64emu_t* emu);
 
+void RemoveDlopen(library_t** lib, int idx); // defined in wrappedlibdl.c
+
 #endif //__LIBRARY_PRIVATE_H_