[GiNaC-devel] Patch 6 version 2

Jan private jrheinlaender at gmx.de
Sat Sep 11 12:54:39 CEST 2010


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
2. added the const
3. omitted them because the code compiles without them (probably adding
a const would also solve the problem)

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: 1737 bytes
Desc: not available
URL: <http://www.cebix.net/pipermail/ginac-devel/attachments/20100911/e8336a11/attachment.patch>


More information about the GiNaC-devel mailing list