My suggestion - add routins for enumeration shared libraries already loaded by current process
For example we have host app
1) host.exe(or just bin on nix)
2) host.exe dynamically loads some plugin.dll/so
3) plugin.dll/so loads impl.dll/so automatically by lnker's import table(before run host(for example on linux) we set LD_LIBRARY_PATH to directory with impl.so to choose actual implementation)
4) now from host.exe i want to set some global variable inside impl.so(for example some global interfaces used by impl) - but i dont know which of impl.so was loaded inside my process, i can not determine path of loaded dll/so - so i can't import symbol
i wrote some platform dependent code to demonstrate root of my suggestion
My suggestion - add routins for enumeration shared libraries already loaded by current process
For example we have host app 1) host.exe(or just bin on nix) 2) host.exe dynamically loads some plugin.dll/so 3) plugin.dll/so loads impl.dll/so automatically by lnker's import table(before run host(for example on linux) we set LD_LIBRARY_PATH to directory with impl.so to choose actual implementation) 4) now from host.exe i want to set some global variable inside impl.so(for example some global interfaces used by impl) - but i dont know which of impl.so was loaded inside my process, i can not determine path of loaded dll/so - so i can't import symbol
i wrote some platform dependent code to demonstrate root of my suggestion
Overall i think enumeration of loaded libraries will be usefull in many other cases too
PS For Windows OS this article will be useful obviosly https://learn.microsoft.com/en-us/windows/win32/psapi/enumerating-all-modules-for-a-process