GMP symbol naming (and the history thereof)?
tg at gmplib.org
Thu Feb 28 10:43:20 CET 2013
nisse at lysator.liu.se (Niels Möller) writes:
I think it make sense with some level of name mangling from API symbols
to linker names. First, it's good practice to use a single prefix for
all linker symbols, while it's nice to use multiple prefixes for API
symbols (mpz_*, mpn_*, gmp_*, ...).
Second, and maybe you don't agree, I think it's quite reasonable for
users to use the name spaces mpz_* and mpn_* for application functions
working with the corresponding types. With some name mangling for gmp
symbol names, at least that user doesn't risk collision with the
internal gmp functions.
That's indeed one of my motivations. And this *does* happen, it is not
a hypothetical problem such as our invasion if the "implementation name
Third, I think it's desirable if gmp and mini-gmp keep using different
symbol names as seen by the linker.
But I don't think using a __ prefix on symbols is appropriate, it would
be better to use the namespace gmp_* or maybe libgmp_*.
Any solution here is a compromise. And there are more drawbacks with
dropping the __ than retaining it. Hmm, perhaps we could use the prefix
iouyfvhbiqckbfgkuigblkiuyggggggcuyhfbg, to make things more clean? The
risk of an accidental collision should be quite limited, and there is
hopefully no paragraph in some standard document somewhere against which
we would be in breach. :-)
More information about the gmp-devel