
Hi, I have a python package with C extensions. In Python 2.5 on Windows, it works as expected. In Python 2.7, it compiles and installs, but the import fails with: ImportError: DLL load failed: The specified procedure could not be found. I found a program called "Dependecy Walker" that tells me this about the .pyd file: Error: At least one required implicit or forwarded dependency was not found. Warning: At least one delay-load dependency module was not found. Warning: At least one module has an unresolved import due to a missing export function in a delay-load dependent module. It also says the missing library is MSVCR90.DLL which contains things like malloc and printf. (It is also missing IESHIMS.DLL and WER.DLL but those are required by IEFRAME.DLL, so they may be a secondary problem.) Apparently, MSVCR90 is a newer version of the C runtime library. I have several copies of MSVCR71.DLL on my machine, but nothing named MSVCR90.DLL. This leads to an obvious question: How did I manage to compile C source code that depends on a shared library that is not even present on my machine? I suspect it is because whoever built the Python distribution did it with a compiler that did have MSVCR90, and python remembered and told distutils. Some web searching led me to find "vcredist_x86.exe" on Microsoft's web site, but installing that did not fix anything and did not create a file on my system name MSVCR90.DLL. From http://support.microsoft.com/kb/326922 , I get the impression that MSVCR90.DLL should have been distributed with Python. Or maybe not... I'm about at the limit of my Windows expertise here. Can anybody help? Mark S.

Apparently, MSVCR90 is a newer version of the C runtime library. I have several copies of MSVCR71.DLL on my machine, but nothing named MSVCR90.DLL.
I'm pretty sure you do have this DLL: the Python installation came with it. Check the WinSxS folder.
Some web searching led me to find "vcredist_x86.exe" on Microsoft's web site, but installing that did not fix anything and did not create a file on my system name MSVCR90.DLL.
Most likely, it didn't because you had the file before. If you didn't have it, it would have put it into the WinSxS folder. Regards, Martin

Martin v. Löwis wrote:
Apparently, MSVCR90 is a newer version of the C runtime library. I have several copies of MSVCR71.DLL on my machine, but nothing named MSVCR90.DLL.
I'm pretty sure you do have this DLL: the Python installation came with it. Check the WinSxS folder.
You're right - I found these: c:/Windows/WinSxS/x86_Microsoft.VC90.CRT_1fc8b3b9a1e18e3b_9.0.21022.8_x-ww_d08d0375/msvcr90.dll c:/Windows/WinSxS/x86_Microsoft.VC90.CRT_1fc8b3b9a1e18e3b_9.0.30729.1_x-ww_6f74963e/msvcr90.dll The modification time on the first one is March 26 2009, but the time on the second one is Jan 3 2011 15:30. That would be around the time I was trying to install vcredist_x86.exe to fix the problem. I still can't import the module, so if one of these DLLs is in the correct place, I can't trust the tool that tells me which DLL is missing. In that case, how do I debug this?
import calcos Traceback (most recent call last): ... File "C:\Python27\lib\site-packages\calcos\cosutil.py", line 13, in <module> import ccos ImportError: DLL load failed: The specified procedure could not be found.
Just to be sure, I've gone back and re-compiled it from clean source. There is no indication of any compile errors, and it didn't make any difference. Mark

ImportError: DLL load failed: The specified procedure could not be found.
Just to be sure, I've gone back and re-compiled it from clean source. There is no indication of any compile errors, and it didn't make any difference.
This is different from "DLL not found", though: it means that the DLL *was* found, but doesn't have one of the symbols that is being used. Unfortunately, it doesn't tell which symbol, and in which DLL.
In that case, how do I debug this?
There are a number of ways: 1. load the pyd into depends.exe, and see whether it shows problems. 2. use sxstrace.exe Regards, Martin

Martin v. Löwis wrote:
ImportError: DLL load failed: The specified procedure could not be found. Just to be sure, I've gone back and re-compiled it from clean source. There is no indication of any compile errors, and it didn't make any difference.
This is different from "DLL not found", though: it means that the DLL *was* found, but doesn't have one of the symbols that is being used. Unfortunately, it doesn't tell which symbol, and in which DLL.
Thanks - that is useful to know.
In that case, how do I debug this?
There are a number of ways:
1. load the pyd into depends.exe, and see whether it shows problems.
depends.exe said "Error opening file. The system cannot find the file specified (2)." about msvcr90.dll. :(
2. use sxstrace.exe
Is there some documentation for it somewhere? I'm not getting anything useful from start->help or google. Maybe you can help me with a more general question: My group writes python code (including c extensions) on linux/mac, then distribute a windows installer using distutils bdist_wininst. The presumption is that you can expect to do that without Windows-specific development expertise. Is that a realistic expectation? Mark

Maybe you can help me with a more general question: My group writes python code (including c extensions) on linux/mac, then distribute a windows installer using distutils bdist_wininst. The presumption is that you can expect to do that without Windows-specific development expertise. Is that a realistic expectation?
What compiler are you using? If it's not msvc, then no, this is not a realistic expectation. If you do build on Windows with the right MSC version, then you can probably manage by paying someone once to set the build process up, and then only running the build process. There is a good chance that you break the Windows build every now and then, and then it will be very time-consuming to diagnose the problem and fix it, without expertise (roughly the same is probably true if you target any other system without knowing what you are doing). Regards, Martin
participants (2)
-
"Martin v. Löwis"
-
Mark Sienkiewicz