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

Waldemar Osuch waldemar.osuch at gmail.com
Fri Aug 7 22:47:42 CEST 2009


On Fri, Aug 7, 2009 at 11:19 AM, Tim Roberts<timr at probo.com> wrote:
> Jason Baker wrote:
>>
>> Nope.  I get linker errors saying it cant find a whole slew of symbols
>> from the Python library.  I haven't been able to figure out any other
>> way to get it to work without replacing python25.lib with python25.dll
>> (from C:\WINDOWS\SYSTEM32).
>>
>> If it makes any difference, I'm using MinGW to build this.
>>
>
> It makes a HUGE difference.  The gcc compiler in MinGW doesn't
> understand the Microsoft library format.  If you want to build
> extensions with MinGW, then you must build your Python from source,
> using MinGW.  You can't use a standard distribution.  (Well, you could
> use the Python that is available through Cygwin, I believe).

This is not true the standard distribution includes libpython26.a that is
usable from MinGW.
The only thing I have to do is to specify compiler, like so
setup.py -c mingw32

and the rest is taken care off by magic of distutils.

>
> I believe there are recipes on the web that describe this.  On the
> whole, I would think it would be much easier to go download the
> appropriate free Visual Studio Express Edition that matches your Python
> version, and use that to build your extension.
>
Unfortunately some extension do not build using VS.  An example is is
python-ldap

Waldemar


More information about the python-win32 mailing list