Loading tbb12.dll fails if its dependencies are located in `LOAD_LIBRARY_SEARCH_USER_DIRS` directories
Summary
I am building python module dependent in tbb, and when packing it I pack libraries into special folder. When importing module dll load fails (on loading msvc140.dll if it is not in common location but it user specified dll search path (it worked in oneTBB 2021.11.0)).
Version
oneTBB 2021.13.0
Environment
Windows 11 python 3.11 MSVC
Observed Behavior
Library does not load
Expected Behavior
Library loads
Steps To Reproduce
Please have a look at related issue https://github.com/adang1345/delvewheel/issues/49
There are several important steps to see the problem:
- One should repair dll using https://pypi.org/project/delvewheel/ or any other similar tool (it is important not to load dependencies from system locations)
- Dependencies and tbb12 should be located in user added dll search path (not system one)
- Load tbb12.dll
It turned out that while loading tbb12.dll it changes system dlls search path and cannot find msvc140.dll that in my case located right near tbb12.dll
I think the reason is https://github.com/oneapi-src/oneTBB/compare/v2021.11.0...v2021.13.0#diff-01fb64c473f1e70ed71d0d37e62daa12d13f2bd487df508e550a80f8ead82f9bR38 this change. But is it expected to affect dependencies?
The issue appears since #1330