GMP, OpenWatcom

Arctic Fidelity af at sacrificumdeo.net
Thu Apr 7 08:38:22 CEST 2005


On 7 Apr 2005 at 12:03, Sisyphus wrote:

> > So, instead, I was thinking of compiling the dll using gcc and
> > MySys. I can do that, but the calling conventions seem off or
> > something when I try to use OpenWatcom and the resulting dll.
> 
> With gcc (MinGW) you don't have to link to libgmp.a - you can link directly
> to the dll. With Microsoft compilers, however, I don't think you can do
> that - you have to link to libgmp.lib. What's the go with Open Watcom - can
> you link directly to the dll ? - or do you have to link to libgmp.a ? Maybe
> try both ways and see if that helps. Is there a way to create a libgmp.a
> suitable for Open Watcom using the def file (as can be done with Visual
> Studio) ?

Yes, the import library does have to be created. I did this with "wlib 
libgmp.lib +libgmp-3.dll" and it created and import library. The 
problem is that the library, when I list the functions in it, do not have 
any of the decorations one would expect, and I think that's where 
I'm getting my undefined reference issue, because it's looking at 
the lib file and only finding the original names rather than the new 
names. I don't know much about anything with dll's, and I'm 
completely lost when it comes to def files, the documentation I 
have read on them only further confused me. I couldn't tell when 
what was done or why. :-(

For example, __gmp_prinf is listed in the import library. But when 
I'm calling it with cdecl conventions, the linker looks for 
___gmp_printf instead. And if I use __declspec(dllimport) then the 
linker looks for __imp____gmp_printf, and neither of those seem to 
be in the import library.

--
Arctic Fidelity <af at sacrificumdeo.net> 
<http://www.sacrificumdeo.net>
"Beware of bugs in the above code; I have only proved it correct, 
not tried it." -- 
Donald Knuth




More information about the gmp-discuss mailing list