
On 7/7/2010 1:19 AM, Robert Ramey wrote:
All this really caught me by surprise. Is there any documentation on this?
On BOOST_SYMBOL_VISIBLE or on GCC's visibility? For the former, I don't think so. For the latter, here's the closest thing I know of that offers useful details: <http://gcc.gnu.org/wiki/Visibility>.
Is there a comprehensive set of tests to verify how this works in different compilers? Seems to me there are a number of interrelated facets.
I doubt it.
a) visibility b) code stripping
Those two are, really, the same thing, if I understand your terminology correctly. The point of visibility is to determine what must be exposed to clients of a DSO/DLL by GCC. What isn't visible isn't exported, may be optimized away, recognized as unused so discarded, etc.
c) handling of the same instantiated code in different modules
That's necessarily platform dependent as the Standard doesn't recognize dynamic libraries.
d) interaction with auto-linking (through shared macro names)
I don't know how that maps into this space, unfortunately.
e) at least 3 different compilers which have at least slight differences (MSVC, gcc, Borland, and ?)
Since this isn't Standard specified behavior, platform differences are de rigueur.
f) at least as far as I know - no guidence from the C++ standard.
As noted.
g) our testing regimen doesn't really test all combinations - debug/release dll/lib, auto-lib/no-autolib, in a comprehensive and systematic way. So we can't know when we've really got it right.
No doubt true.
I've had to spend a lot of time on all of the above. It was in an ad hoc / piecemeal fashion which was not at all satisfactory. So sorting all this out is a very worthwhile task. But I can't help thinking that the scope of this issue and size of the task has been underestimated.
The only thing I suppose to be difficult is the corner cases such as GCC requiring things to be marked visible that MSVC doesn't require be exported. Discovering those, most likely, will require trial and error, though one can apply the known rules (dynamic_cast, user-defined exception types, class template static data members) to find an initial set. ___ Rob