-----Original Message----- From: Brian Gladman

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.

Aaah, that makes things a little clearer to me. (I hadn't grasped that from the OP's post.)

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.

Hmm ... I was thinking that whenever an mpir_ui gets passed to the DLL, it will only ever be a 32-bit value. But that won't bother the DLL because a long long accurately handles 32-bit values (on little endian machines, at least). But if the DLL also passes back 64-bit values, and those values are getting truncated to 32 bits then, yes, that wouldn't be pretty ;-)

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

Could that be built into mpir.h (inside an '#ifdef _MSC_VER' block) ?
If that's possible, then it would seem a good solution for these "hybrid" situations.

It looks to me that the problem, when using MSVC with a mingw-built library, is not with the library itself, but is limited to the mpir.h header.
That being the case, I can see only 2 solutions:
1) Forbid  using a mingw-built library with MSVC or;
2) Fix the mpir.h header.

Cheers,
Rob


--
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.

Reply via email to