Kevin Ryde
Fri, 25 Oct 2002 11:39:42 +1000

Sam Krasnik <> writes:
> i am trying to build an app to be cross platform linux/windows. i have
> seen instructions on how to build gmp 4.0.1 for windows. i assume the
> same applies for 4.1, but does anyone know of (or have) the
> .lib,.dill, and .h file for windows that will work with vc6?

Others have been able to get msvc to compile it, but doing so from the
main dist is probably doomed.  (Libtool doesn't understand ".lib"
files for a start I don't think.)

We suggest a mingw dll, updated notes from the manual below.  If you
use the debian mingw32 cross compile packages you can configure with

  ./configure --host=i586-mingw32msvc --disable-static --enable-shared

Microsoft Windows
     On systems `*-*-cygwin*', `*-*-mingw*' and `*-*-pw32*' by default
     GMP builds only a static library, but a DLL can be built instead

          ./configure --disable-static --enable-shared

     Static and DLL libraries can't both be built, since certain export
     directives in `gmp.h' must be different.  `--enable-cxx' cannot be
     used when building a DLL, since libtool doesn't currently support
     C++ DLLs.  This might change in the future.

Microsoft C
     A MINGW DLL build of GMP can be used with Microsoft C.  Libtool
     doesn't install `.lib' and `.exp' files, but they can be created
     with the following commands, where `/my/inst/dir' is the install
     directory (with a `lib' subdirectory).

          lib /machine:IX86 /def:_libs/libgmp-3.dll-def
          cp libgmp-3.lib /my/inst/dir/lib
          cp _libs/libgmp-3.dll-exp /my/inst/dir/lib/libgmp-3.exp

     MINGW uses `msvcrt.dll' for I/O, so applications wanting to use
     the GMP I/O routines must be compiled with `cl /MD' to do the
     same.  If one of the other I/O choices provided by MS C is desired
     then the suggestion is to use the GMP string functions and confine
     I/O to the application.