delta trinity deltatrinity@hotmail.com
Wed, 18 Dec 2002 12:26:47 -0500

>I've two questions about GMP.
>Can I operate with integers that are represented with 744 decimals (309 
>bytes) at full precision (not as doubles with 18-20 decimal places)?

The mpf structure are multi-precision.  You could have, let's say, precision 
of 100 000 digits with no problems.

>How can I use GMP in FreePascal or Delphi?

The easiest way would be to use the 'shared' version of the compiled GMP 
(.DLL).  You would need to compile GMP first with c compiler or find a dll 
built for your intended target (ex, LIBGMP-3.DLL optimized for Pentium 3 or 

Then, you will need to convert gmp.h, possibly to a unit.  You'll need to 
first convert all the structures to pascal records.  Convert all constants.  
Then, for each functions, you will need to deflare them as pascal 
equivalent, ex:

function mpz_init(mpz_t mpz_ptr) ; external 'LIBGMP-3.DLL'
   name '__gmpz_init' ;

You'll probably need to put double underscore at the beginning.  To know how 
each functions are declared in the dll, use the TDUMP.EXE utility 'tdump 
libgmp-3.dll'.  This won't show the parameters to call the functions but the 
gmp.h will.

It can be long if you don't have an utility (is there one?).  I managed to 
do this convertion stuff a few years ago while I was a pro-pascal :) and 
converted some Novell Netware functions from C headers by hand for use with 
Borland Pascal for Windows.  I also used converted header (that I found on 
the web) of DirectX for use with Delphi.  You may want to look for this 
package (search for '+delphi +directx' in Google).  Those will probably give 
some tips and an idea on the structure you need to build.

>Best regards, Sergey.
>MSN 8 helps eliminate e-mail viruses. Get 2 months FREE*. 
>gmp-discuss mailing list

Add photos to your e-mail with MSN 8. Get 2 months FREE*.