[python-win32] Pb SxS for install

Mark Hammond skippy.hammond at gmail.com
Sat Jan 31 03:44:55 CET 2009


On 31/01/2009 11:23 AM, Tim Roberts wrote:
> Mark Hammond wrote:
>> IIUC, we have determined that unless the CRT assembly is installed globally,
>> every .DLL or .EXE which references the VC9 CRT must have a copy of that CRT
>> next to itself.  For example, if python26.dll references the CRT and
>> socket.pyd references the CRT via its menifest, and these files are not in
>> the same directory, 2 copies of the CRT are needed - the socket module will
>> *not* be use the one *already loaded* by python.  Or something like that :)
>>
>
> Not quite, but almost.
>
> A manifest resource has a number, like all resources.  That number
> determines the "scope" of the manifest.  A manifest with number 1
> becomes the default manifest for the whole process.  A manifest with
> number 2 is a manifest only for the binary in which it is contained.
>
> So, if python26.dll includes a manifest #2, that only applies to
> python26.dll.  Any other DLLs must include their own manifests to point
> to the CRT, otherwise you get an activation error.  But if python26.dll
> includes a manifest #1, then it becomes the default manifest for the
> process, and other DLLs do not have to include their own.

Interesting.  In most of these failure scenarios, the executable itself 
doesn't have a reference to the assembly - only the DLL does.  The DLL 
has a manifest with an ID of 2 - I seem to recall having problems trying 
to use an ID of 1 with a DLL, but I can't be sure.  Regardless, as you 
mention, it's unclear what happens when such a DLL is loaded - it 
*replaces* any manifest with an ID of 1 the executable might have had?

So - in the case of mod_python or COM objects, the executable doesn't 
reference the assembly, but Python's DLL does - which in terms of the 
above, implies there is no "default manifest" for the process.  We've 
used the ActivateActCtx() etc functions to allow these DLLs to load 
correctly.

http://bugs.python.org/issue4566 is what I am basing my faulty 
recollections from :)

Cheers,

Mark


More information about the python-win32 mailing list