Build GMP on 64bit Windows

后端 未结 5 1678
无人共我
无人共我 2021-02-02 00:33

I have followed the instruction on the \"GMP Install Instruction for Windows Platform\". I could build a 32bit version of GMP which can be used for Visual Studio.



        
5条回答
  •  星月不相逢
    2021-02-02 00:55

    How I built dynamic dll gmp-6.1.2 for windows so that the dll can be linked for a visual studio project.

    Setup Environment

    • Install 7-Zip
    • Install Cygwin, add the following packages to the default installation
      • gcc-core
      • gcc-g++
      • libgcc
      • m4
      • make
      • cmake
      • bash
    • Add the following Environment Variable to the User PATH: C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\VC\Tools\MSVC\14.15.26726\bin\Hostx64\x64
      • This is so you can use the lib command. Your lib.exe may be located elsewhere.

    Build GMP

    • Download the tar.bz2 version from https://gmplib.org/#DOWNLOAD and extract the gmp-6.1.2 folder with 7-zip.
    • Launch bash.exe from C:\cygwin64\bin.
    • Change directory to the unzipped gmp-6.1.2 folder. Ex: cd "A:\Code\gmp-6.1.2"
    • Execute ./configure --disable-static --enable-shared
    • Execute make
      • This will create cyggmp-10.dll under A:\Code\gmp-6.1.2\.libs\
    • Execute make check
    • Execute cd ./libs
    • Execute lib /machine:i386 /def:cyggmp-10.dll
      • This will generate cyggmp-10.exp and cyggmp-10.lib under A:\Code\gmp-6.1.2\.libs\ for use with visual studio

    You now have everything needed to call gmp from C# code.

提交回复
热议问题