On 15/10/2014 08:15, sisyph...@optusnet.com.au wrote: > > > -----Original Message----- From: Brian Gladman > Sent: Wednesday, October 15, 2014 5:44 PM > To: mpir-devel@googlegroups.com > Subject: Re: [mpir-devel] __WIN64 and _LONG_LONG_LIMB > > On 15/10/2014 03:06, Bill Hart wrote: >> Ah, that explains it. Mingw uses __WIN64 not _WIN64. > > With mingw.org compilers (which are still only 32-bit) neither _WIN64 > nor __WIN64 are defined. (Checked against gcc-4.7.0.) > With the 64-bit mingw-w64 compilers both _WIN64 and __WIN64 are defined. > (Checked against gcc-4.8.2.) > With the 32-bit mingw-w64 compilers neither _WIN64 nor __WIN64 are > defined. (Checked against gcc-4.8.2.) > > All of these compilers can be installed on 64-bit windows - the "64-bit > mingw-w64" compiler produces 64-bit executables, the other two compilers > produce 32-bit executables (all of which run on 64-bit Windows machines). > For some other macros that these compilers define, see the "MinGW and > MinGW-w64" section at > http://sourceforge.net/p/predef/wiki/Compilers/ > > I don't think __WIN64 is ever defined when using a Microsoft compiler.
That is correct - the Microsoft define is _WIN64. What is less clear (to me at least since I don't use mingw or cygwin environments) is what gets defined during a mingw64 build since the bit I add to mpir.h to get the correct long long types in MSVC won't be there in this case. The original poster is trying to use a mingw64 produced DLL to build an application with the Microsoft compiler so he will NOT get the mpir.h file that is specifically designed for use with the MS compiler but whatever mingw64 produces. Since it appears that __WIN64 is defined by mingw64, it will use long long limbs for mpir_ui and mpir_si but when this same mpir.h is used by MSVC it will presumably see these defined as longs. In any event, the full section that gets added to mpir.h during an MSVC build is: #if ! defined (__GMP_WITHIN_CONFIGURE) #ifdef _WIN32 # ifdef _WIN64 # define _LONG_LONG_LIMB 1 # define GMP_LIMB_BITS 64 # else # define GMP_LIMB_BITS 32 # endif # define __GMP_BITS_PER_MP_LIMB GMP_LIMB_BITS # define SIZEOF_MP_LIMB_T (GMP_LIMB_BITS >> 3) # define GMP_NAIL_BITS 0 #endif #endif so there are more changes that just _LONG_LONG_LIMB that are needed to build and use a DLL with MSVC. All of which raises the issue of support for such hybrid build environments (part mingw64, part MSVC), which, as far as I am aware, are not consciously supported by MPIR and are not tested during MPIR development (I am not even sure that anyone is testing mingw64 builds, let alone hybrid ones!). Brian -- You received this message because you are subscribed to the Google Groups "mpir-devel" group. To unsubscribe from this group and stop receiving emails from it, send an email to mpir-devel+unsubscr...@googlegroups.com. To post to this group, send email to mpir-devel@googlegroups.com. Visit this group at http://groups.google.com/group/mpir-devel. For more options, visit https://groups.google.com/d/optout.