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

Eric Hanchrow offby1 at blarg.net
Sat May 8 21:29:44 CEST 2004

I've noticed that the version of libgmp that comes with Cygwin is just
a DLL (and an import library); there's no static library.  This is a
shame, since (for reasons I don't understand) the nice Perl module
Math::BigInt::GMP (which of course links with GMP) doesn't build out
of the box.  The workaround is to simply rebuild GMP statically.  But
I'd love it if that library could build out of the box.

I can think of a few ways to make that happen:

* Simply change the Cygwin package of GMP to use the static library
  instead of the DLL.  I've already suggested this to the Cygwin
  package maintainer (lapo at lapo.it) but have not yet heard back.
  This would amount to making official the workaround I mentioned

* Add some Cygwin-specific hack to the Makefile.PL for
  Math::BigInt::GMP that will allow it to work with the shared
  library.  (I'd have thought this would be easy to do, but when I
  tried it, its tests all failed with Windows error 998, which I think
  means that some DLL got an access violation while it was loading; I
  haven't yet investigated.)

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

The first two approaches seem more or less like hacks; thus I'd like
to investigate doing the third.  Perhaps it's a tremendous amount of
work, of which I'm incapable; but perhaps it's easy, and hasn't been
done simply because nobody needed both libraries on Cygwin (maybe I'm
the first!)  If it's the latter, I'd like to start working on it.

So: does anyone have an opinion on just how hard that last approach
would be?  Or of a better approach that I haven't thought of?


Tobacco: It's not just for killing children anymore.

More information about the gmp-discuss mailing list