What would be needed to allow GMP to build both a static library and a DLL on Cygwin?

Kevin Ryde user42 at zip.com.au
Sun May 9 02:45:06 CEST 2004


Eric Hanchrow <offby1 at blarg.net> writes:
>
> Math::BigInt::GMP (which of course links with GMP) doesn't build out
> of the box.

Nobody here can do anything about that.  Unless it's a gmp problem in
which case make a bug report.

> * Somehow change GMP so that it (like most other libraries) builds
>   both a DLL and a static library.

The reason they don't is the way import directives are given on the
prototypes for the shared library, and not for the static.  gmp.h
varies according to whether you're going to link to the shared or
static.

I think import directives are only an optimization for functions, but
they're vital for global data.  These days mingw apparently has an
auto-import scheme for data, which might be enough.  Maybe cygwin has
something similar.  The way gmp is setup pre-dates that, it goes back
to original libtool recommendations for dlls.

One annoying thing about import directives is that they prevent
function pointers being used as initializers for constant data.  The
GMP perl module has a workaround for that, but demos/expr is still
afflicted.  You can get around it by compiling as C++, probably.  I'm
not sure what mingw users would normally recommend.


More information about the gmp-discuss mailing list