Using python23 to develop an extension for an application that has python22 embedded

Andrew MacIntyre andymac at bullseye.apana.org.au
Wed Apr 7 19:04:52 EDT 2004


On Wed, 7 Apr 2004, Michael Geary wrote:

> Andrew MacIntyre wrote:
> > You can then use another compiler supported by the
> > Distutils (MS CL non-optimising compiler, MinGW,
> > Borland etc) to build the distributable extension in
> > either a Python 2.2 or 2.3 installation, without risking
> > mixing C runtime library mismatches (VS.NET uses a
> > different CRT than VS6 I understand).  If using a 2.3
> > installation, you'll need to substitute a 2.2 import
> > library when building the final distributable version.
>
> Do I understand you correctly? It sounds like you are saying there is a
> problem using a DLL built with VC6 and another DLL built with VS.NET in the
> same application, but if you were to use a Borland or other compiler, then
> you would avoid this problem.

No, I was referring to the fact that VS.NET links DLLs to a different C
runtime than VS6.  Borland may indeed not achieve what I suggested; I have
never used it in conjunction with Python.  MinGW links by default to the
same MSVCRT.DLL as VS6's DLLs (at least the versions I've used do).

While mixing C runtime libraries may appear to work for some cases, it
doesn't for other cases - file handles/streams and memory allocation are
frequent causes of contention (frequently segfaults).  I'm aware that
you're a much more seasoned Win32 developer than I so expect you have a
clearer picture about this; but this is my experience.

I have come across an instance where some code produced by an older
version of gcc (2.8.1) was the source of a segfault when linked to a body
of code produced by a much later version (3.2.1), though it was fine if
the rest of the code was also produced by the same version, or a somewhat
newer version (2.95).  A royal PITA that was; had to rebuild the
problematic library (at least I could get the source).

--
Andrew I MacIntyre                     "These thoughts are mine alone..."
E-mail: andymac at bullseye.apana.org.au  (pref) | Snail: PO Box 370
        andymac at pcug.org.au             (alt) |        Belconnen  ACT  2616
Web:    http://www.andymac.org/               |        Australia




More information about the Python-list mailing list