I've spent last 2 days trying to launch examples from Boost.Python with the "ImportError: DLL load failed: The specified module could not be found" error, while trying to load compiled (using bjam) pyd modules. I was using Windows 7 x64, Python 2.7 x64 with Boost 1.47. I've followed up different answers on StackOverflow and other sites incl. fresh installs (Python 32 and 64 bit, Boost precompiled), manual Boost's libraries building, DLL checks with dependency walker and so on, with no luck. I registered to share the solution, which worked here and which I hope may help someone, struggling with the same error ;)
Asked
Active
Viewed 5,332 times
5
-
The problem was with the [KB2264107 Windows update](http://support.microsoft.com/kb/2264107), "fixing" the DLL search routine (security fix). Setting the registry value [HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager] : CWDIllegalInDllSearch to 0, allowed to properly load DLL files and properly import .pyd modules. This may also happen on other Windows versions. – stx Nov 13 '11 at 13:03
-
welcome to SO. Note that SO is an answer and questions site. It is not a blog to log your accomplishements in programming. – joaquin Nov 13 '11 at 17:52
-
@joaquin I know, but how can I share the solution when someone will struggle with the similar problem? If it's a [very discouraged manner](http://meta.stackexchange.com/questions/17463/should-i-ask-a-question-i-know-the-answer-to) and this thread is not proper, please moderator remove it. – stx Nov 13 '11 at 23:03
-
your answer below is perfectly valid but you should not include your answer in the place for comments as above or in the question itself. Keep it as a question as concise and precise as possible. – joaquin Nov 14 '11 at 16:47
3 Answers
6
Two solution, no need to use regedit
- add
BOOST_PYTHON_STATIC_LIB
marco when build your dll. It will let boost.python static link to your dll file rather than dynamic load in runtime. - add boost.python dll to PATH or copy it to same dir where your dll locate

jean
- 2,825
- 2
- 35
- 72
-
I got the same problem. It is related to DLL search path but has nothing to do with the KB2264107 Windows update ("fixing" of the DLL search routine). 2 is the correct answer. – user5280911 May 26 '17 at 04:57
2
The problem was with the KB2264107 Windows update (http://support.microsoft.com/kb/2264107), "messing" with DLL search routine (security fix). Setting the registry value [HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager] : CWDIllegalInDllSearch to 0, allowed to properly load DLL files and properly import .pyd modules. This may also happen on other Windows versions.

stx
- 123
- 2
- 8
0
my soluition is download microsoft visual c++ 2015 redistribute https://www.microsoft.com/en-us/download/details.aspx?id=48145

bijiofzxx
- 11
- 1