Question about __gmpf_abs and __gmpz_legendre compilation
delta trinity
deltatrinity at hotmail.com
Sun May 16 13:33:08 CEST 2004
Hello
I don't know if it's a Borland issue or if the problem could originate from
GMP. I have this scenario:
I compiled GMP 4.1.3 shared lib.
I then used Borland 'IMPLIB' utility to generate a '.LIB' from the DLL, so
the linker find references to the DLL entry (how to link to it, the export
name, find by name or ordinal, ...)
However, when I generate the .lib, everything is fine until I use either of
the functions mpf_abs or mpz_legendre.
After investigation, I found that in the .lib generated by IMPLIB, those two
entry are specified to be imported by ordinal instead of by name, and they
get imported as __gmp... instead of ___gmp... (2 instead of 3 underscores)
while every other functions are specified to be imported by name. I have
put an extract of TDUMP output at the end of this message.
What happen is that if I use any of those 2 functions, the linker complain
about unresolved external references.
I worked around the problem by forcing IMPLIB to import by name (-f
parameter). Ex:
IMPLIB -a -f LIBGMP-3.LIB LIBGMP-3.DLL instead of
IMPLIB -a LIBGMP-3.LIB LIBGMP-3.DLL
(-a tell to add an underscore for MSVC-style cdecl exports, and is required
in this case, else I get unresolved externals for every functions).
It may be IMPLIB, but is it possible that something is different in GMP
about those two functions?
I don't see how, as the declaration seem the same for every functions.
Though, it could be gcc or the libtool used to compile GMP.
Thanks
Eric
==========
Appendix
==========
The two exports without the 'force by name':
0016D0 THEADR __gmpf_abs
0016DF COMENT Purge: Yes, List: Yes, Class: 160 (0A0h), SubClass: 1 (01h)
Dynamic link import (IMPDEF)
Imported by: ordinal
Internal Name: __gmpf_abs
Module Name: libgmp-3.dll
ordinal: 64
001701 COMENT Purge: Yes, List: Yes, Class: 251 (0FBh), SubClass: 3 (03h)
Hint:63
00170A MODEND
006C50 THEADR __gmpz_legendre
006C64 COMENT Purge: Yes, List: Yes, Class: 160 (0A0h), SubClass: 1 (01h)
Dynamic link import (IMPDEF)
Imported by: ordinal
Internal Name: __gmpz_legendre
Module Name: libgmp-3.dll
ordinal: 320
006C8B COMENT Purge: Yes, List: Yes, Class: 251 (0FBh), SubClass: 3 (03h)
Hint:319
006C94 MODEND
==========
Compared to other exports:
001710 THEADR ___gmpf_add
001720 COMENT Purge: Yes, List: Yes, Class: 160 (0A0h), SubClass: 1 (01h)
Dynamic link import (IMPDEF)
Imported by: name
Internal Name: ___gmpf_add
Module Name: libgmp-3.dll
Imported name: __gmpf_add
00174C MODEND
==========
With the force by name
0016D0 THEADR __gmpf_abs
0016DF COMENT Purge: Yes, List: Yes, Class: 160 (0A0h), SubClass: 1 (01h)
Dynamic link import (IMPDEF)
Imported by: name
Internal Name: __gmpf_abs
Module Name: libgmp-3.dll
001701 COMENT Purge: Yes, List: Yes, Class: 251 (0FBh), SubClass: 3 (03h)
Hint:63
00170A MODEND
_________________________________________________________________
Stop worrying about overloading your inbox - get MSN Hotmail Extra Storage!
http://join.msn.click-url.com/go/onm00200362ave/direct/01/
More information about the gmp-bugs
mailing list