On Jul 12, 2006, at 10:04 AM, Tristan Wibberley wrote:

This isn't "type" visibility. Shared objects don't export "types" they export "symbols". The types are defined in headers and are thus known to exist - no visibility attributes will or should change that.

Actually in C++, they are exported, it is one of the "funny" things which people don't realize about C++. This is the normal ODR (one definition rule) rules which are coming into play which the visibility on the class, it is not no longer exported from the shared library.

If the programmer had intended that the type should appear to not exist. it wouldn't be defined in a header #include-able by client code. The compiler should assume that the type exists and can be used if it is defined and shouldn't change attributes on other parts of the program.

But that code would be invalid (though no diagnostic is required) code by the ODR rules in C++.

This is the main difference between C++ and C where in C compatible types actually can have different names while in C++ they cannot and if two different types in C++ are the same name, the code is invalid
(though no diagnostic is required).

-- Pinski

Reply via email to