Win32 Libs for 2.4

Robin Becker robin at reportlab.com
Tue Dec 7 05:44:25 EST 2004


Martin v. Löwis wrote:
> Robin Becker wrote:
> 
>> I thought that static .libs didn't make reference to the dll's they 
>> need; isn't that done at load time?
> 
> 
> Unfortunately, thanks to Microsoft's infinite wisdom, static libs
> *do* reference DLLs. The C lib headers contain things like
> 
> #pragma lib("msvcrt.lib") // or some such
> 

according to my docs

there's something called a comment pragma used thusly

#pragma comment( lib, "xxx.lib" )

which places a search record into the obj file. I don't think this forces the 
linker to load stuff from this module although I can see that it might be 
dangerous depending on which obj files are seen first.


> The compiler translates this into a reference to the DLL in the
> object file, which the linker will then translate into a reference
> to the DLL when linking, even if the DLL was not giving on the linker
> command line.

I believe this is a weak reference from the documentation.

> 
> However, I am uncertain how this works with multiple VC versions -
> whether the DLL reference is CRT version independent or not.
> You should view the resulting extension module in depends.exe,
> and check whether it refers to multiplce CRT dlls (which would be
> bad).
> 

well in my 2.4 _imaging.pyd I see direct references to only msvcr71.dll,
but there is a direct reference to USER32.dll which references ADVAPI32.dll
which references WINTRUST.dll which then references msvcrt.dll. Fortunately I 
don't think this is a problem as Python24.dll also references USER32.dll directly.

Perhaps a genius level cretifiable (whoops Freudian mispelling of certified) 
knows whether this is OK.


> Regards,
> Martin


-- 
Robin Becker




More information about the Python-list mailing list