[python-win32] Why can I compile a C extension if I replace python25.lib with python25.dll?

Tim Roberts timr at probo.com
Fri Aug 7 18:40:07 CEST 2009


Jason Baker wrote:
> I've been trying to get Storm's C extensions to compile under windows.
>  For some reason, it wasn't able to find python25.dll, even if I paste
> it directly under libs or DLLs.  My theory was that it was finding
> python25.lib (which I'm guessing is a static library) and trying to
> use that instead.
>   

No.  Python25.lib is an import library.  It doesn't contain any code. 
All it contains is special linker records that say "this entry point
will be found in python25.dll at run-time".

You need Python25.lib when you build the extension.  You need
Python25.dll when you run a program that uses it.

> If I remove python25.lib and replace it with python25.dll, it works
> fine.  This solution doesn't really seem like a good one to me though.
>   

That doesn't make sense.  The linker won't use python25.dll.  It can't
-- it's not in the right format.  The linker needs the .lib.  Then, when
you run the app, the DLL must be accessible somewhere.  Does the build
process try to test the extensions?

-- 
Tim Roberts, timr at probo.com
Providenza & Boekelheide, Inc.



More information about the python-win32 mailing list