This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |
Other format: | [Raw text] |
Chris Lattner wrote:This construct seems like it should be rejected by the C++ front-end.
The source is making two contradictory claims: the struct is not visible
outside this library, but part of it is implemented outside of it.
I don't think there's a contradiction. The declaration on the structure
is the default for the members and applies to the vtable and other class
data.
So, why not:
struct S __attribute__((visibility("hidden")) { void f(); void g() __attribute__((dllimport)); }; void S::f() { S::g(); };
I'm not sure why you say that the code is broken. It works.
As far as I know it doesn't violate any specification.
There's no reason the members shouldn't be implemented elsewhere,
and there's certainly existing code (in Windows, SymbianOS, and other
DLL-based operating systems, whether or not there is on GNU/Linux) that
implements different class members in different DLLs, while still not
exporting the class from its home DLL. One situation where this is
useful is when the class members are actually shared between multiple
classes, or are also callable as C functions, etc.
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |