msvcp71.dll and Python 2.4 C++ extensions
"Martin v. Löwis"
martin at v.loewis.de
Mon Jan 31 18:14:30 EST 2005
Matthias Baas wrote:
> are there any guidelines about what to do if a Windows extension for
> Python 2.4 requires the C++ runtime (msvcp71.dll)?
No; it should "just work fine". The standard guidelines apply, of
course: never try to mix different versions of similar DLLs.
> If I want to
> distribute a binary installer of an extension that contains C++ code,
> should I really include the msvcp71.dll in the package?
If you cannot expect your users to have that file, you should distribute
it. Make sure you have read and understood the Microsoft license
concerning the file.
> It doesn't
> sound like a good idea to me if every package places another copy of
> this dll somewhere in the Python directory.
Why not? If your installer follows Windows logo compliance rules, it
should check whether the DLL is already present; if it is, it should
check whether the version installed is newer than the one it would
install, and if so, should skip installation.
> Python 2.4 does install the C runtime (msvcr71.dll) in the Windows
> system32 directory, doesn't it?
It depends. If this is an allusers installation, it does so. For a
per-user installation, the user might not have sufficient privileges
to install into system32, so the installer won't install it there.
> (btw, shouldn't this be installed in
> the Python directory instead?)
No. If you install the DLL into the Python directory, Python
will not work anymore because python24.dll (installed into system32)
will not find this DLL. If you then also move python24.dll into
the Python directory, COM components that require python24.dll will
fail to run.
> So would it be possible that future
> Python releases would also install the C++ runtime?
Why should it? Nothing in the Python distribution requires C++.
> I think it's
> better if the dll would only be installed once by Python instead of
> several times by every extension that uses C++.
Why is that better? The DLL versioning rules, and the shared DLL
refcounting mechanisms will make sure that the installation works
> Currently, I do not package the C++ runtime and leave it up to the
> user to install the dll if it isn't already somewhere on his system.
> But this really is not a satisfying solution...
Then you should probably include the DLL, or rewrite your extension
to not use C++.
More information about the Python-list