This is typically done by specifying the DLL dependency in a manifest file that resides with the executable. However, I don't know how to accomplish this in Python. Loading the DLL isn't an issue, but rather finding the appropriate DLL in the SXS to load is the problem.
Is there a standard procedure for specifying where to find the DLL ? For this example let's assume it lives here:
c:\windows\winsxs\amd64_my_handy_lib_<public_key_token>_1.0.0.0_none_<some_ID>
Do I REALLY need to manually search the c:\windows\winsxs
directory looking for my DLL by name, then check the parent directory to see if it contains the correct version?
I just don't do Python projects enough to know what the appropriate way to accomplish this.
Here's an example that loads the CRT from the WinSxS directory.
actctx.manifest:
actctx.py:
output:
This was tested under Python 3.4.2, which is built with VS 2010 and links with msvcr100.dll instead. So at least in this case setting the activation context was really required, else loading msvcr90.dll would fail with
ERROR_MOD_NOT_FOUND
.