GMP 4.2 build on x64 with Visual Studio 2005

Degski degski at
Tue Mar 28 14:45:33 CEST 2006

To those concerned,

I've succesfully built GMP 4.2 (LIBs and DLLs) on Windows XP x64 with
Microsoft Visual Studio 2005, 64-bit version. This build/solution is
based on Brian Gladman's Solution as found on his site, equally using
his assembler code (with YASM).

Main things to do, create projects for the four headers/tables to be
generated. some extern-issue with __clz_tab (VS doesn't like the way
it's defined), split \mpn\generic\popham.c in popcount.c and hamdist.c
(and make proper definitions). As compared to Brian Gladman's solution
add/delete some files as appropriate.

There are some issues left and i would like to request your input:

I've modified the definition of:

mpn_divexact_by3c (mp_ptr restrict rp, mp_srcptr restrict up,
mp_size_t un, mp_limb_t c)


mpn_divexact_by3c (__int64 * __restrict rp, __int64 * __restrict up,
mp_size_t un, mp_limb_t c)

since VS doesn't like the restrict (or __restrict in VS's case) before
*, it wants it after the * (as in my mods). Obviously this creates a
discrepancy (and relevant warning) as compared to the declaration of
that function.

My question(s):

Is the restrict really necessary, or is it beneficial? If yes, how
could I fix this issue, without generating modifications throughout
the code?

Other question:

The x86_64 assembler is it intended for 64-bit or 32-bit, I cannot get
my head around the  AT&T-syntax. If it is 64-bit assembler, is there a
way to compile it under Win64 (with YASM?).

Lastly, I could make a project with all the code available to anybody
interested, I've build a solution that (for the LIBs) includes MPC and
MPFI as well, didn't try for the DLL's.

All credits go to Brian Gladman, my thanks.

You can mail me at degski[at]

More information about the gmp-discuss mailing list