]> www.ginac.de Git - ginac.git/commit
[msvc] Work around strange scoping and name mangling rules.
authorJan Rheinländer <jrheinlaender@gmx.de>
Mon, 20 Sep 2010 12:23:14 +0000 (12:23 +0000)
committerAlexei Sheplyakov <Alexei.Sheplyakov@gmail.com>
Fri, 26 Nov 2010 22:15:55 +0000 (00:15 +0200)
commit4e100d18fa168f13f17d2b272e2e750748112995
treea47db1005b655407a4acafb32640fd4c23947aa2
parentec57359e970338a6bbc3043c91af7e5bcfb0c8fa
[msvc] Work around strange scoping and name mangling rules.

1. msvc creates different symbols for a variable declared in
   a namespace scope and (the same variable) in a class method
   scope. That is,

   // util.cpp
   namespace GiNaC {
   extern const ex _ex0; // [1]
   }
   // ex.h
   namespace GiNaC {
   class ex {
   public:
          bool is_zero() {
                extern const ex _ex0;
                // mangled name of _ex0 is different that of [1]
          }
   };
   }

2. The mangled names for cv-qualified and cv-unqualified versions
   of a type are different (which violates the requirements stated
   in [basic.type.qualifier])

These msvc's "features" cause linking failures due to unresolved
external symbols.

Solution:
1. Declare variables (_ex0) in the GiNaC namespace scope (for msvc only).
2. Add corresponding cv-qualifier(s).
ginac/ex.h
ginac/parser/parse_binop_rhs.cpp
ginac/parser/parser.cpp