Skip to content
Wikus Coetser edited this page Feb 9, 2016 · 6 revisions

#How to compile the GNU Multi Precision Arithmetic Library for Windows

  1. Download msys2 (https://msys2.github.io/)
  2. Update msys2 (http://sourceforge.net/p/msys2/wiki/MSYS2%20introduction/)
  3. Install compiler toolchain: (On the msys2 command line). Run "pacman -S mingw-w64-x86_64-gcc" and "pacman -S autoconf make automake"
  4. Download gmp and copy to C:\msys64\home\Administrator (Note: "Administrator" could be your Windows username.)
  5. Run C:\msys64\mingw64_shell
  6. cd to /home/Administrator/gmp-6.1.0
  7. Run: ./configure --disable-static --enable-shared (to make a DLL file)
  8. Run: make
  9. Watch C stuff scroll by.
  10. Run: "make check", to check that GMP has build as expected and all tests pass.
  11. Get the end-product libraries: copy them from C:\msys64\home\Administrator\gmp-6.1.0\.libs
  12. Check the export functions: run "dumpbin /exports .\GMP.libs\libgmp-10.dll" on the "visual studio" command prompt. This showed 620 exported functions with their actual names used in DllImport(EntryPoint=...)
  13. Get the config.h file generated in the compilation process to see that defines where used. (ex. C:\msys64\home\Administrator\gmp-6.1.0\config.h). This give the define statements used to compile GMP and can help with reading the compiled code in order to create structs etc. for PInvoke.

Clone this wiki locally