[Distutils] Re: distutils?- Borland Extensions

Rene Liebscher R.Liebscher@gmx.de
Mon Oct 30 08:07:01 2000

Gordon Williams wrote:
> If you want to use distutils with Borland to compile extensions to work with
> the MS binary distribution you will have to have some way of using the
> COFF2OMF import library conversion tool on the python20.lib file.  We need
> to link with the converted library and not the python20.lib which is
> supplied with the distribution.  (See the instructions about mypylib.lib)
Distutils uses the name python20_bcpp.lib for mypylib.lib (See also 
the explanation at the end of this mail.)
> ----- Original Message -----
> From: "Joseph VanAndel" <vanandel@ucar.edu>
> To: "Gordon Williams" <g_will@cyberus.ca>
> Cc: <gward@python.net>; <Distutils-SIG@python.org>
> Sent: Wednesday, October 25, 2000 11:08 PM
> Subject: Re: distutils?
> > http://www.cyberus.ca/~g_will/pyExtenDL.shtml
> >
> > ...
> >
> > Gordon:
> > You've written some nice instructions on how to obtain and install the
> > Borland free compiler.  You provide instructions on how to customize
> > batch files to compile and link extensions on Windows.
> >
> > Actually, 'distutils' is precisely designed to build extensions.  Rather
> > than .bat scripts, you describe how to build your extension in a
> > 'setup.py' file.  The advantage of using distutils is that it can
> > compile your code on multiple platforms, with a minimum amount of
> > machine dependencies in the script.  And of course, distutils ships
> > standard with Python 2.0.
> >
> > distutils now works with the Microsoft Visual C compiler.  There was
> > some work done on using the free Borland compiler, but I don't know if
> > it was finished.
> >
> > Greg (and the distutils gang) - is the free Borland compiler support for
> > Windows working at present?
> >
Distutils can be used with the free Borland compiler too.
(I have tried it with PyOpenGL 1.5.5 and one of my packages, 
but it surely needs more testing.)

What is to do?
First convert all MSVC++ libraries you need from COFF to OMF.
coff2omf python20.lib python20_bcpp.lib

The suffix _bcpp is important if you don't want replace to 
original files (python20.lib,...)

When you want to link against a library (python20), distutils checks
if there is a library with _bcpp suffix and uses it, otherwise
it tries the normal name for the library (python20.lib).

The second point is, you have to specify that you want to use the
Borland compiler.
python setup.py install build_ext --compiler=bcpp

This is all.

Kind regards
Rene Liebscher