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
Fri May 28 02:18:33 CEST 2004

Having a bit more of a look, removing the import/export business in
favour of plain thunks and auto-import may work.

There's only three documented variables in libgmp, mp_bits_per_limb,
gmp_version and gmp_errno.  All are 32 bits so work fine with

For ms and borland I'm assuming auto-import doesn't exist.  One
possibility would be to switch to a function interface for the
variables (when on a dll system), like

	#define gmp_version  (* gmp_version_get_addr())

This is not quite source-compatible, in that it's no longer a constant

Binary compatibility may be a problem too (for MS users).  Old code
compiled for static could still only run with static, old code for
shared could probably be kept working with a hack to add __imp's to
the static libgmp.  Maybe all MS applications are only using the

What do windows users think?

The advantages would be to reduce the nonsense in gmp.h, make function
pointers into constants, and allow static and shared at the same time.
The disadvantage would probably be that only a new enough mingw could
run the test programs.

More information about the gmp-discuss mailing list