eGenix extensions / GMP

Duncan Smith buzzard at urubu.freeserve.co.uk
Tue Dec 11 14:44:58 EST 2001


Thanks for responding, but I'm still a bit stuck.  Details below.

"Alex Martelli" <aleax at aleax.it> wrote in message
news:9v5gfs0a6h at enews4.newsguy.com...
> "Duncan Smith" <buzzard at urubu.freeserve.co.uk> wrote in message
> news:9v5df1$tla$1 at newsg4.svr.pol.co.uk...
> > I have recently installed the eGenix experimental extensions.  This
> includes
> > a Windows port of GMP 3.1.1.  That works fine.  But I would also like to
> use
> > GMP via PyInline (or C++), but the C compiler doesn't seem to recognise
> that
> > GMP is present.  I have also downloaded the Windows port separately from
> > http://www.lemburg.com/files/python/, but I'm not sure where to go from
> > here.  Anyone any idea how to sort this out (step by step)?  Python 2.1,
> > Visual Studio 6 on Win 2000.  Thanks in advance.
>
> I've regularly used the Windows GMP port that comes with gmpy (see
> gmpy.sourceforge.net) on its own (not via PyInline -- never tried
> that).  For that, you basically just need to have Visual C++ find
> the .h file (for compilation) and .lib (for linking), either by
> placing those files in existing VC++ recognized directories or by
> adding to your environment suitable variables.
>

I've tried copying gmp.h and gmp31.lib to the relevant directories.  I can
#include <gmp.h> without the compiler throwing a wobbler, but if I try
something like mpz_mul (x, x, x); in my code I get the message, 'BuildError:
error: command '"C:\Program Files\Microsoft Visual
Studio\VC98\BIN\link.exe"' failed with exit status 1120'.  I'm sure the
files I have in gmp-3.1.1-win32-1.zip are all I need if I only knew what to
do with them.  The files are:

gmp31.dll
gmp31.lib
gmp31.exp
gmp.h
gmp-3.1.1-win32.patch
Readme
Copying.lib

Of these files, only the DLL is evident in my mx extensions installation.

The relevant part of the Readme text is:

"This archive contains the GNU MP lib compiled as DLL using MS VC6 on a

i386 machine. To link against the DLL, simply add the gmpXX.lib file

to your link options and redistribute the gmpXX.dll and this archive

together with your application."

I have checked out gmpy.  Now I have several ways I can use 'integers of
arbitrary length' in Python.  But what I really want is the way that
requires a proper installation of GMP (in the sense that the C compiler
doesn't knock it back).

> Take care, though: if you compile this way, each DLL you build
> will be using its own copy of GMP.

Oh.  Not the best then.

I don't know if Lemburg's port
> exposes a C-API (to let other Python-extension DLL's/PYD's share
> just one GMP); gmpy's does, and there's an example distributed
> with it of another C-coded Python extension using that API.  I
> don't know about PyInline, though.
>

Didn't find any examples, just a couple of pyds.  Cheers.

>
> Alex
>
>
>





More information about the Python-list mailing list