gmp.h uses undefined preprocessor symbol

Niels Möller nisse at
Sun Oct 20 09:19:16 UTC 2019

Simon Sobisch <simonsobisch at> writes:

> The following bug exists since at least GMP 4.3 and still persists:
> different systems and use it later.

As far as I understand, they should be used only via __GMP_DECLSPEC,
which does have a default empty definition. It's a bit subtle, and I
don't understand all the details (e.g., it's not clear to me where
__GMP_LIBGMP_DLL is defined).

> The problem: it does not define it to something for unknown environments.

Please be more concrete. What environent are you having trouble with,
and what are the errors?

> The attached patch defines them empty when the compiler is not known and
> adds the working definition for the OrangeC compiler.

Adding the orangec compiler looks good, but I'm not sure the default
empty part is an improvement. As far as I understand, it's not possible
to build a working dll without import/export marking of symbols. And for
unsupported compilers it seems perferable to fail early rather than

It would make more sense to me to make either the __GNUC__ or _MSC_VER
versions the default, if it seems likely that new compilers will try to
be compatible with one (or both) of those, as seems to be the case with
orangec. And if they aren't, that should manifest as a clear compile
time error.


Niels Möller. PGP-encrypted email is preferred. Keyid 368C6677.
Internet email is subject to wholesale government surveillance.

More information about the gmp-bugs mailing list