<html><head><metahttp-equiv="X-UA-Compatible"content="IE=edge"/><linkrel="shortcut icon"href="../icons/favicon.ico"/><linkrel="stylesheet"type="text/css"href="../styles/branding.css"/><linkrel="stylesheet"type="text/css"href="../styles/branding-en-US.css"/><scripttype="text/javascript"src="../scripts/branding.js"></script><metahttp-equiv="Content-Type"content="text/html; charset=UTF-8"/><title>Welcome to the GMP Native Interface for .NET Library</title><metaname="Language"content="en-us"/><metaname="System.Keywords"content="Welcome"/><metaname="Microsoft.Help.Id"content="846f5c8a-6cba-433e-9f18-cde2ff5695cd"/><metaname="Description"content="The GMP Native Interface for .NET Library exposes to .NET (through P-Invoke and .NET types) all of the functionality of the GNU MP Libraryhttps://gmplib.org/ (version 6.1.2)."/><metaname="Microsoft.Help.ContentType"content="Concepts"/><metaname="BrandingAware"content="true"/><linkrel="stylesheet"type="text/css"href="../styles/branding-Website.css"/><scripttype="text/javascript"src="../scripts/jquery-1.11.0.min.js"></script><scripttype="text/javascript"src="../scripts/branding-Website.js"></script><scripttype="text/javascript"src="../scripts/clipboard.min.js"></script></head><bodyonload="OnLoad('cs')"><inputtype="hidden"id="userDataCache"class="userDataStyle"/><divclass="pageHeader"id="PageHeader">GMP Native Interface for .NET<formid="SearchForm"method="get"action="#"onsubmit="javascript:TransferToSearchPage(); return false;"><inputid="SearchTextBox"type="text"maxlength="200"/><buttonid="SearchButton"type="submit"></button></form></div><divclass="pageBody"><divclass="leftNav"id="leftNav"><divid="tocNav"><divclass="toclevel0"data-toclevel="0"data-childrenloaded="true"><aclass="tocExpanded"onclick="javascript: Toggle(this);"href="#!"/><adata-tochassubtree="true"href="846f5c8a-6cba-433e-9f18-cde2ff5695cd.htm"title="GMP Native Interface for .NET"tocid="roottoc">GMP Native Interface for .NET</a></div><divclass="toclevel1 current"data-toclevel="1"><adata-tochassubtree="false"href="846f5c8a-6cba-433e-9f18-cde2ff5695cd.htm"title="Welcome to the GMP Native Interface for .NET Library"tocid="846f5c8a-6cba-433e-9f18-cde2ff5695cd">Welcome to the GMP Native Interface for .NET Library</a></div><divclass="toclevel1"data-toclevel="1"><aclass="tocCollapsed"onclick="javascript: Toggle(this);"href="#!"/><adata-tochassubtree="true"href="d9c51b9f-0c54-770b-28ea-6eebd8fef368.htm"title="Math.Gmp.Native"tocid="d9c51b9f-0c54-770b-28ea-6eebd8fef368">Math.Gmp.Native</a></div></div><divid="tocResizableEW"onmousedown="OnMouseDown(event);"></div><divid="TocResize"class="tocResize"><imgid="ResizeImageIncrease"src="../icons/TocOpen.gif"onclick="OnIncreaseToc()"alt="Click or drag to resize"title="Click or drag to resize"/><imgid="ResizeImageReset"src="../icons/TocClose.gif"style="display:none"onclick="OnResetToc()"alt="Click or drag to resize"title="Click or drag to resize"/></div></div><divclass="topicContent"id="TopicContent"><tableclass="titleTable"><tr><tdclass="titleColumn">Welcome to the GMP Native Interface for .NET Library</td></tr></table><spanclass="introStyle"></span><divclass="introduction"><p>
The <strong>GMP Native Interface for .NET Library</strong> exposes to .NET (through P-Invoke and .NET types)
</p></div><divclass="collapsibleAreaRegion"><spanclass="collapsibleRegionTitle"onclick="SectionExpandCollapse('ID1RB')"onkeypress="SectionExpandCollapse_CheckKey('ID1RB', event)"tabindex="0"><imgid="ID1RBToggle"class="collapseToggle"src="../icons/SectionExpanded.png"/>C and .NET Types Equivalence</span></div><divid="ID1RBSection"class="collapsibleSection"><p>
The table below shows how each C type maps to .NET.
Note that the <ahref="bf1f694d-f9b2-6413-12e5-ebae603d5b49.htm">mp_limb_t</a>
and <ahref="d9761bfb-1882-59d2-e89b-c6460141f9a6.htm">size_t</a> C types map
to the CPU word, i.e., 32 or 64 bits.
In particular, because <ahref="bf1f694d-f9b2-6413-12e5-ebae603d5b49.htm">mp_limb_t</a>
is the type of the integers that make up multi-precision numbers, matching the CPU word size ensures
maximum performance.
Unless you intend to use low-level (mpn) functions, you do not need to take into account the
CPU word size, and can build for the "Any CPU" platform.
</p><divclass="tableSection"><table><tr><th><p>C Types</p></th><th><p>.NET Types</p></th></tr><tr><td><p>short</p></td><td><p>Int16</p></td></tr><tr><td><p>int</p></td><td><p>Int32</p></td></tr><tr><td><p>long</p></td><td><p>Int32</p></td></tr><tr><td><p>long long</p></td><td><p>Int64</p></td></tr><tr><td><p><ahref="1b2b1d64-20c1-7a64-0278-d9ff58ee9cc3.htm">mp_bitcnt_t</a></p></td><td><p>UInt32</p></td></tr><tr><td><p><ahref="e6a17880-791f-37d4-4942-cf26ce7d4cbf.htm">mp_exp_t</a></p></td><td><p>Int32</p></td></tr><tr><td><p><ahref="4b58a584-7a0e-b600-18fa-ebd493861eb3.htm">mp_size_t</a></p></td><td><p>Int32</p></td></tr><tr><td><p><ahref="bf1f694d-f9b2-6413-12e5-ebae603d5b49.htm">mp_limb_t</a></p></td><td><p>UInt32 (on 32-bit CPU) / UInt64 (on 64-bit CPU)</p></td></tr><tr><td><p><ahref="d9761bfb-1882-59d2-e89b-c6460141f9a6.htm">size_t</a></p></td><td><p>UInt32 (on 32-bit CPU) / UInt64 (on 64-bit CPU)</p></td></tr></table></div></div><divclass="collapsibleAreaRegion"><spanclass="collapsibleRegionTitle"onclick="SectionExpandCollapse('ID2RB')"onkeypress="SectionExpandCollapse_CheckKey('ID2RB', event)"tabindex="0"><imgid="ID2RBToggle"class="collapseToggle"src="../icons/SectionExpanded.png"/>Building the GNU MP Library on Windows</span></div><divid="ID2RBSection"class="collapsibleSection"><ol><li><p>
Install MSYS2
</p><p>
Get the latest version from...
</p></li><li><p>Install yasm</p></li><li><p>Install GNU MP</p></li><li><p>Build GNU MP</p></li></ol></div><divclass="collapsibleAreaRegion"id="seeAlsoSection"><spanclass="collapsibleRegionTitle"onclick="SectionExpandCollapse('ID3RB')"onkeypress="SectionExpandCollapse_CheckKey('ID3RB', event)"tabindex="0"><imgid="ID3RBToggle"class="collapseToggle"src="../icons/SectionExpanded.png"/>See Also</span></div><divid="ID3RBSection"class="collapsibleSection"><h4class="subHeading">Other Resources</h4><divclass="seeAlsoStyle"><ahref="http://en.cppreference.com/w/c/numeric/math"target="_self">C Standard</a></div><divclass="seeAlsoStyle"><ahref="https://github.com/MachineCognitis/Math.Gmp.Native"target="_self">Math.Gmp.Native on GitHub</a></div></div></div></div><divid="pageFooter"class="pageFooter"/></body></html>