next up previous contents index
Next: Profiling Up: User Guide Previous: Compatibility with C types   Contents   Index


Using GMP

The type Integer described in this document is actually a macro, which defaults to AldorInteger, the software integers provided by the ALDOR runtime. For efficiency or other reasons, you may prefer to use the GMP3library, which is supported by libaldor. The easiest way to use GMP is to compile all your source files with the options
-dGMP -cruntime=foam-gmp,gmp
The option -dGMP makes Integer point to the type GMPInteger, while the other option, which is necessary only when linking an executable, ensure that GMP makes use of the ALDOR garbage collector. All you need is GMP 3.0 or later installed in a file called libgmp.a to produce executables. Using GMP generally produces more efficient programs, but programs calling GMP cannot be interpreted by the ALDOR compiler, nor can they run inside its interactive loop.

Using the -dGMP option allows you to compile the same sources either with or without GMP, which can be appreciable, but you must ensure that you do mix files compiled with and without -dGMP since the macro Integer would then be expanded into two different types.

An additional advantage of using GMP, is that GMPInteger exports and uses internally several of the in-place or higher-level operations of GMP, which are not available with AldorInteger. In addition, variables of type GMPInteger are compatible with the C type mpz_t from GMP, so you can directly call C programs that use GMP from your ALDOR code.


next up previous contents index
Next: Profiling Up: User Guide Previous: Compatibility with C types   Contents   Index
Manuel Bronstein 2004-06-28