Pyrex installation on windows XP: step-by-step guide

sturlamolden sturlamolden at yahoo.no
Fri May 26 14:13:55 EDT 2006


Gonzalo Monzón wrote:

> Does this happen if you're releasing, i.e. a built exe with py2exe,
> where you supply the right crt? or if you do supply the right crt on the
> application folder? ...

It does not matter which crt you "supply". The dynamic linker will
attempt to load the crt specified by the import library that you linked
when the extension was built. What will happen, is that Windows will
search through its "search path" (i.e. the current folder and  folder
specified by the PATH environment variable) until it find the crt it
wants.


> I see there are both libraries linked in my pyrex modules...  However,
> when one should expect to have problems with this "dll nightmare", if
> you always provide the right msvcr71.dll bundled within your project -I
> mean, using py2exe by example- ?

Windows will e.g. look in its own directories as well. You can bundle
msvcr71.dll, but msvcrt.dll will always be available in
c:\windows\system32. If you used an import library for msvcrt.dll, then
msvcrt.dll will be loaded.

Also you cannot legally bundle msvcr71.dll unless you hold a license
for Visual Studio 2003. There are no other way to legally redistribute
msvcr71.dll. Other versions of Visual Studio allows redistribution of
other versions of the crt. Visual C++ Toolkit 2003 only allows a
statically linked crt.

> Of course if you didn't bundle the right crt, it does depend on the
> available crt on target system...

No it does not. It always depends on the CRT specified by the import
library. If you linked against msvcr71.lib, then the extension needs to
load msvcr71.dll. If Windows cannot find msvcr71.dll on the search
path, the process will be killed. It is your responsibility to make
sure msvcr71.lib reside on the search path. If it cannot be found,
Windows will not load a different crt instead. Windows will pop up a
warning message telling you that msvcr71.dll cannot be found, and then
kill the process.

If you linked against msvcrt.lib, then the extension will load
msvcrt.dll.




More information about the Python-list mailing list