Hi,

first of all, I would like to thank the developers of (GMP and) MPIR
for this great library. I am using it in my own open source library,
libDAI.

When using MPIR in a Win64 environment, I encountered the problem that
the C++ wrappers do not seem to handle 64-bit integers, like size_t's
(or long long ints). This is illustrated by the following code, which
compiles fine under 64-bit linux, but fails to compile in a Windows 64
environment:

---
#include <gmpxx.h>
#include <iostream>
using namespace std;
int main(void) {
    size_t a = 5;
    mpz_class b(a);
    cout << b.get_ui() << endl;
    return 0;
}
---

The reason seems to be that a size_t is a 64-bit integer in Win64,
whereas an unsigned long is only 32 bits in that environment, and the C
++ wrapper classes in MPIR only provide a constructor for mpz_class
from (up to) 32-bit integer types. The C part of the library does
provide such functionality by the function mpz_init_set_ux().
On 64-bit linux, however, an unsigned long is 64 bits, and therefore
the code runs fine.

Now to me, this seems to be an undesirable cross-platform
incompatability. On the MPIR homepage, I read that two of the primary
goals of MPIR are:
- To maintain full interface support with GMP - MPIR is a drop-in
replacement for GMP.
- Support for building MPIR using Microsoft Visual Studio 2010 for use
in both 32-bit and 64-bit versions of Windows.
Such a platform dependence as discussed above seems to conflict with
these goals.

So I have the following questions (sorry, I am new to this list, and
didn't read all the previous conversations, although I tried searching
for this issue on this list, without much success):
- Is this a known issue (I saw some other posts on this list and on
the internet which mention, so I suspect the answer would be "yes")?
- Is somebody working on it?
- Would it be difficult to add support for 64-bit integers to the C++
wrappers also for platforms where an unsigned long is only 32 bits?
- Is there a reason that this hasn't been dealt with yet?

Thanks for your time,
Joris

-- 
You received this message because you are subscribed to the Google Groups 
"mpir-devel" group.
To post to this group, send email to mpir-devel@googlegroups.com.
To unsubscribe from this group, send email to 
mpir-devel+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/mpir-devel?hl=en.

Reply via email to