Support Loader/Unloader function for libraries
In discussion with @Lars (and others), to forcibly trigger an unload function prior to closing a library. Uses a framework similar to codedBase dlLibraryTable.patch
Cross-ref EP1197. Patch from Bram.
No child items are currently assigned. Use child items to break down this issue into smaller parts.
Link issues together to show that they're related. Learn more.
Activity
- Mark OLESEN assigned to @mark
assigned to @mark
- Mark OLESEN changed the description
changed the description
- Mark OLESEN mentioned in merge request !309 (closed)
mentioned in merge request !309 (closed)
/cc @bram.metsch
Edited by Bram Metsch- Mark OLESEN changed the description
changed the description
As I am not allowed to push: in addition to
feature-dlLibrary-unloader
, I needed the following change:diff --git a/src/OpenFOAM/db/dynamicLibrary/dlLibraryTable/dlLibraryTable.C b/src/OpenFOAM/db/dynamicLibrary/dlLibraryTable/dlLibraryTable.C index 5242406..dcab583 100644 --- a/src/OpenFOAM/db/dynamicLibrary/dlLibraryTable/dlLibraryTable.C +++ b/src/OpenFOAM/db/dynamicLibrary/dlLibraryTable/dlLibraryTable.C @@ -341,6 +341,15 @@ void* Foam::dlLibraryTable::open if (ptr) { +#ifdef Foam_exptl_dlLibraryLoaderHooks + // Attempt load immediately after open + loadHook + ( + ptr, + dynamicCode::libraryBaseName(libName), + debug // verbosity according to debug + ); +#endif libPtrs_.append(ptr); libNames_.append(libName); }
- Author Maintainer
Sure, but just to be clear any of the changes here are currently just a way to exchange information. Won't be making any real code changes until the release is out. The final version will also need to have a different naming mechanism than simply using
dynamicCode::libraryBaseName(libName)
.Imagine you have some library
libmpi.so
orlibpetsc-1.so
that you load. Is it reasonable or safe to execute anmpi(bool)
or apetsc-1(bool)
function? Probably not. - Mark OLESEN mentioned in issue #1585 (closed)
mentioned in issue #1585 (closed)
- Mark OLESEN mentioned in commit 2811c054
mentioned in commit 2811c054
- Author Maintainer
Should be unnecessary after 2811c054 - can revisit if still needed
- Mark OLESEN closed
closed