GMP 4.2.1 release candidate available
gmpdevel at personal.formauri.es
Mon Oct 9 01:36:31 CEST 2006
Sorry for the late reply.
On 08/16/2006 04:50:29 PM, Camm Maguire wrote:
> We use gmp for random numbers. Latest gmp is giving us some problems
> with random states, returned by gmp_randinit_default:
> 1) the 625 word seed area is allocated with gmp_alloc, but the
> mp_alloc field is not set. We need this to know how to gc this
> object. Right now we are using a temporary hack to trap the
> allocated size.
I've submitted a patch to set the allocation size field properly.
> 2) A pointer to a static area is returned in _mp_algdata->_mp_lc
> (e.g. &Mersenne_Twister_Generator). Please make this unstatic,
> i.e. export the struct to the user. It is very common in these
> programs to dump the running memory image to a file, and restart it
> later. If gmp is dynamically linked, the load address can be
> different, and aforementioned pointer, stored in the heap, rendered
> invalid. If the structure was exported, I could refer to it in a
> gcl C file, and rely on ldd to do the relocation. Alternatively,
> if randseed_mt was non-static, we could do the same for the
> elements of gmp_randfnptr_t as opposed to the body.
In my opinion, exporting private structures is not the proper way to
deal with dumping. Instead there are plans for implementing random
state export/import functions which, I believe, will fit your needs
In the meantime you can mirror the private struct to do what you intend.
-- Pedro Gimeno
More information about the gmp-devel