Tristan Wibberley <[EMAIL PROTECTED]> writes: | Daniel Jacobowitz wrote: | > On Wed, Jul 12, 2006 at 02:04:37AM +0100, Tristan Wibberley wrote: | >> 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 | > GCC doesn't know if the header is includable by client code; I assume | > that's the use Jason intended for marking classes hidden ("it belongs | > to this shared object and no one else can see it"). | | | No, that's why we need programmer provided attributes. The programmer says: | | "the client code needs to know about the existence of this type so it | can get pointers and references to instances and pass them back in | later and maybe be able to call virtual member functions and access | non-static members" by putting it in a header which they document | should be included by client code - thus client code includes it and | knows about the type. But the programmer says:
It strikes as you are assuming C and C++ have a notion of module. They don't. They have the notion of "translation unit." C++ adds the notion of "One Definition Rule" to make sure Bad Things don't happen. You have to operate within that framework if you're going to touch the C++ type system in any way. -- Gaby