GMP and Win32

Brian Gladman
Wed, 4 Jun 2003 15:52:57 +0100

In response to Jim White:

I have now tried your suggestion:

> #if defined (_WIN32DLL)
> #define __GMP_DECLSPEC_EXPORT  _stdcall __declspec(dllexport)
> #define __GMP_DECLSPEC_IMPORT  _stdcall __declspec(dllimport)
> #endif

to see if a native Windows DLL with __stccall calling conventions can be
built easily. But this does not seem easy (with Microsoft VC++ at least).
The problem I am hitting is that the above defines are used in the form:

__GMP_DECLSPEC type function()

and hence expand to:

_stdcall __declspec(dllexport) type function()

when what VC++ wants is:

type __declspec(dllexport) __stdcall function()

And when I change to the latter form, the __stdcall function decoration is
not applied during the actual compilation of these functions so I get
redefinition errors because the header declarations and the actual function
declarations don't match.

Moreover, since the export define is used on data as well as on function
calls, the addition of __stdcall to it breaks all of these instances.

It may be possible to overcome these problems but I am not sure how this can
be easily done.

   Brian Gladman