[GiNaC-devel] Patch 6 version 3

Jan private jrheinlaender at gmx.de
Tue Sep 14 10:57:03 CEST 2010


Hello Alexei,

I found an error in this one so please use the attached file instead.

Problem: 
1. MSVC creates different symbols for "extern const ex _ex0" if it
is declared at top-level (inside GiNaC namespace) and if it is declared
inside the body of a function (also inside GiNaC namespace). When
linking, unresolved external symbols occur.
2. utils.h declares _num_1_p as const, but parse_binop_rhs.cpp omits the
const. MSVC creates different symbols for the two versions, causing
linking errors
3. parser.cpp mentions 
extern numeric* _num_1_p;
extern ex _ex0;
which cause linking problems

Solution: 
1. Moved the declaration out of the body of the function (for MSVC only)
2. added the const
3. added the const for _ex0 and removed _num_1_p because it is not 
referenced in the file at all

Note to 2: 
[basic.type.qualifier] says:

\begin{quote}
The cv-qualified or cv-unqualified versions of a type are distinct
types;
however, they shall have the same representation and alignment
requirements
(3.9)^46)

46)
The same representation and alignment requirements are meant to imply
interchangeability as arguments to functions, return values from
functions,
and members of unions.
\end{quote}

It is not clear how it's possible for cv-qualified and non-cv-qualified
type to have different mangled names without violating the above
requirements, but anyway - MSVC can do it :-)


-------------- next part --------------
A non-text attachment was scrubbed...
Name: _ex0.patch
Type: text/x-patch
Size: 1757 bytes
Desc: not available
URL: <http://www.cebix.net/pipermail/ginac-devel/attachments/20100914/be09a151/attachment.patch>


More information about the GiNaC-devel mailing list