Various patches against gmp-4.3.0
Marc Glisse
marc.glisse at normalesup.org
Thu May 7 07:45:56 CEST 2009
On Thu, 7 May 2009, Peter Cordes wrote:
> No. In C++, if you want to reference stuff defined in C source
> files, the declarations should be inside extern "C" {} blocks. So the
> C++ compiler knows it has to do things the C-compatible way. As I
> understand it, the major effect is to turn off name mangling. If C++
> had a different function calling convention than C on a certain
> platform, extern "C" declarations would solve that problem too. If
> structs had different alignment defaults in C vs. C++, you would need
> extern "C", too. (unlikely, I know, but maybe some C++ compilers take
> extern "C" to mean "be compatible with some special ABI stuff, not
> just the C version of that same compiler.)
I believe that last one (struct alignment) is wrong. I just checked
section 7.5 of the standard: the only things that are supposed to be
affected by language linkage specifications are: function types, function
names and variable names.
But Michiel De Wilde and you are perfectly right for point_string, it does
indeed require the extern "C". Thank you both.
--
Marc Glisse
More information about the gmp-devel
mailing list