[GiNaC-list] Problem using a user-defined class on Mac OS X.
Chris.Dams at mi.infn.it
Chris.Dams at mi.infn.it
Thu Apr 5 10:59:40 CEST 2007
Dear David
> This alone doesn't exhibit the issue in the original example.
> What you've written above is just a plain partial specialization, no
> violation at all. Now, suppose that the last definition above
> (foo<T*>::data) was replaced in a *different* translation unit with:
>
> template <> void* foo<void*>::data = &something_else;
>
> which is similar to the original code in this thread. The instantiation
> of foo<void*>::data can now be different-valued. (Is this analogous to
> the GiNaC source or proposed patch in question?)
No, there is only one instantiation in the GiNaC source. Both in the
unmodified one and the one that I modified to work on Mac OS X. So it
cannot have different values. The point is that in the original GiNaC code
there would be two instances of, say, foo<void*>::data inside the
executable. One comming from the shared library and the other one coming
from the executable itself. Library code would modify the first one and
code from the executable would modify the other one.
To reproduce it in toy code, I think you would have to create a dynamic
library on the Mac, but I havn't tried yet.
I guess, it could have something to do with the so-called two-level
namespaces that the man page of the linker talk about. I could test that.
Best wishes,
Chris
More information about the GiNaC-list
mailing list