How to check the version of GMP, MPFR and CamlIDL?

SoftTimur picture SoftTimur · Sep 19, 2011 · Viewed 8.2k times · Source

My question is simple... How could I check the version of GMP installed on my machine? What about MPFR? And What about CamlIDL?

Thank you very much

Answer

Kryskov Denis picture Kryskov Denis · Apr 10, 2014

To check for GMP(MPIR) version, access string __gmp_version(__mpir_version) in dynamic library called libgmp.so.X.Y.Z(libmpir.so.X.Y.Z). Your standard library directory might contain more than one such file (this happens if you install newer version of GMP or MPIR but your package manager chooses to keep old version because it is still needed).

Cutting off a small Python code fragment from benchmark_det_Dixon.py:

import ctypes
so_name='/usr/lib/libgmp.so'
var_name='__gmp_version'
L=ctypes.cdll.LoadLibrary(so_name)
v=ctypes.c_char_p.in_dll(L,var_name)
print v.value

The code above only works under Linux/Unix; it should be possible to port it to other OS supported by ctypes Python package.

To get MPFR version, call mpfr_get_version():

M=ctypes.cdll.LoadLibrary('/usr/lib/libmpfr.so')
M.mpfr_get_version.restype=ctypes.c_char_p
print M.mpfr_get_version()