[PPL-devel] Re: [Yap-users] First part of the problem: GMP

Vitor Santos Costa vitor at biostat.wisc.edu
Tue Jun 18 18:55:25 CEST 2002


The problem seems to be that Yap defines its own allocation functions
for gmp objects:

#ifdef USE_GMP
  /* YAP style memory allocation */
  mp_set_memory_functions(
			  AllocBigNumSpace,
			  ReAllocBigNumSpace,
			  FreeBigNumSpace);
#endif

This allows Yap to work with such objects in its own
stacks. Unfortunately, these functions require for another function,
PreAllocBigNum to have been called before. In general, using them is a
bit dangerous, because they assume they have control over the global stack.

I suppose Yap is polluting the application space, so the correct
solution would be for Yap to reset these functions before entering
user code. But this would make the interface slower for any
application that doesn't use GMP.

A compromise might be for me to provide two interface functions
(YapResetGMPFunctions() and YapSet GMPFunctions()) and for you to call
them before you started manipulating GMP objects.

Cheers,

Vitor




More information about the PPL-devel mailing list