[GiNaC-list] Problem using a user-defined class on Mac OS X.

Chris.Dams at mi.infn.it Chris.Dams at mi.infn.it
Tue Apr 3 16:49:06 CEST 2007


Dear Alexei,

> There are
>
> template <class OPT> class_info<OPT> *class_info<OPT>::first = NULL;
> template <class OPT> bool class_info<OPT>::parents_identified = false;
>
> in class_info.h. So I wonder why explicit specialization makes any
> difference...

Oh well, I should have said that I also removed these two. Obviously, if
these static members weren't templated it would just have been wrong for
the initializations to be in the header file. It would simply give an
error complaining about symbols being defined more than once. The linker
on the Mac does not seem to have a problem, creating the same mangled name
multiple times, though :-(. Apparently the linker on Linux is smart enough
to only keep one single instance of this variable and on Mac it is still
smart enough if it only has to create the dynamic library but not if this
is to be linked with an executable that also contains this same symbol.
Highly inconvenient. You might be right that it could be a bug somewhere
in the toolchain. Also, the Mac has gcc 3.3 while the Linux that I use has
gcc 4.0.2.

>> Shall I add this file to the CVS?
>
> I think we should understand how it works first.

You have a point there. Maybe I will go and try to hunt for some linker
flags that make it behave properly.

Best wishes,
Chris



More information about the GiNaC-list mailing list