Various patches against gmp-4.3.0

Michiel De Wilde mdewilde.agilent at googlemail.com
Wed May 6 11:03:55 CEST 2009


>  Without the extern "C", the variable "point_string" is subject to C++ name
>  mangling: on win32 it becomes "?point_string@@3PADA", leaving an
> unresolved
>  symbol  "_point_string".
>
> Well, this is a C++ file, point_string is supposed to be a C++ variable,
> so if your compiler mangles its use but not its declaration, it sounds
> like a serious compiler problem.


tests/cxx/clocale.c is a pure C file, declaring "extern char
point_string[];"
tests/cxx/t-locale.cc is a C++ file, defining "char point_string[2];".

Either the C++ file needs to have its definition of point_string wrapped in
extern "C", or at least it should see an "extern" declaration of
point_string wrapped in extern "C" first, which is not the case.
In the current code, the declared point_string in clocale.c and the defined
point_string in t-locale.cc are not guaranteed to map to the same name for
the linker. It happens to work with gcc because this compiler doesn't mangle
global c++ variables (which is fine by itself, but not required).

Kind regards,

Michiel
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://gmplib.org/list-archives/gmp-devel/attachments/20090506/32422d9b/attachment.html>


More information about the gmp-devel mailing list