<DIV>Hi,</DIV>
<DIV> </DIV>
<DIV>I have succesfully compiled gmp-4.1.4 on Windows 2000 MinGw MSYS system.</DIV>
<DIV> </DIV>
<DIV>./configure --enable-shared --disable-static</DIV>
<DIV> </DIV>
<DIV>I then imported the DLL library to Borland C Builder6 by following following steps</DIV>
<DIV> </DIV>
<DIV>1. renamed libgmp-3.dll to gmp.dll (Borland hates "-" in file names) and copied to my project directory.</DIV>
<DIV>2. under Command Prompt</DIV>
<DIV>2.a > impdef gmp.def gmp.dll</DIV>
<DIV>2.b > implib gmp.lib gmp.def</DIV>
<DIV>3. needless to say gmp.h also needs to be copied to a place that Cbuilder6 can find it.</DIV>
<DIV> </DIV>
<DIV>In Borland C Builder6 added gmp.lib to Project .</DIV>
<DIV> </DIV>
<DIV>Using C Builder6 I set following options Menu [project][options]</DIV>
<DIV>Compiler Tab </DIV>
<DIV> - Code optimization - speed</DIV>
<DIV>Advanced Compiler Tab </DIV>
<DIV> - Instruction Set - Pentium</DIV>
<DIV> - Calling conventions - Standard</DIV>
<DIV> </DIV>
<DIV>The program compiles and links properly but if gmp calls are in a loop then a stack overflow is reported after 83000 loops of below code.</DIV>
<DIV> </DIV>
<DIV>while (1)<BR> {</DIV>
<DIV> mpz_mul_ui(n,n,1227750359) ;<BR> mpz_div_ui(n,n,1227750359) ;</DIV>
<DIV> </DIV>
<DIV> count++ ;<BR> if ((count % 1000) ==1) {</DIV>
<DIV> cout << "count = "<<count <<"\n" ;</DIV>
<DIV> }<BR> }</DIV>
<DIV> </DIV>
<DIV>Adding following code resets the stack and program can loop indefinately, a non elageant brute force method to work around the problem.</DIV>
<DIV> </DIV>
<DIV> test = 1 ;<BR> while (test)<BR> {<BR> test = setjmp( envbuf );<BR> }</DIV>
<DIV> while (1)<BR> {</DIV>
<DIV> mpz_mul_ui(n,n,1227750359L);<BR> mpz_div_ui(n,n,1227750359L);</DIV>
<DIV> </DIV>
<DIV> count++ ;<BR> if ((count % 1000) ==1) {</DIV>
<DIV> cout << "count = "<<count <<"\n" ;<BR> longjmp( envbuf, -1 );</DIV>
<DIV> }<BR> }<BR></DIV>
<DIV>The same program compiled under MinGW MSYS and using gcc and the static libraries (a seperate gmp build) does not have the same problems.</DIV>
<DIV> </DIV>
<DIV>My question:</DIV>
<DIV> </DIV>
<DIV>Is there a Borland calling incompatibility to the DLL libary or a DLL bug that the stack grows.</DIV>
<DIV> </DIV>
<DIV>best regards</DIV>
<DIV>Anton</DIV>
<DIV> </DIV>
<DIV> </DIV>
<DIV> </DIV>