RFC: Make dllimport/dllexport imply default visibility

Mark Mitchell mark@codesourcery.com
Wed Jul 4 02:37:00 GMT 2007

Geoffrey Keating wrote:

> Yes.  __attribute__((visibility)) has consistent GNU semantics, and
> other features (eg. -fvisibility-ms-compat, __dllspec) match other
> compilers.

The only semantics that make sense on SymbianOS are the ones that allow
default visibility within a hidden class.  So, whether or not there's a
command-line option, it's going to be on by default, and therefore is
going to be inconsistent with a system on which GCC disallows (or
ignores) that.

However, since this is a conservative extension to your semantics (all
valid programs remain valid and have the same meaning), I don't
understand why you think this is a problem.  The SymbianOS semantics
give the programmer more choices, which, as with most such things, the
programmer can use in good ways or bad.

The good news is that the change that I made caused the compiler to stop
silently ignoring explicit requests from the programmer and without
changing the meaning of any valid programs.  So, we can (and do) still
have consistent GNU semantics across platforms with this change.

> I hope you don't mean that there are other system's compilers using the
> '__attribute__((visibility))' syntax in a way that's incompatible with
> GCC.  If there are, I think the appropriate response is a combination of
> fixincludes and a polite e-mail asking them to stop.

I don't know if there are, but I certainly wouldn't be surprised.  The
GNU attribute syntax is implemented in the EDG front end and there are
lots of EDG-based compilers.

RealView 3.0.x doesn't support the visibility attribute, but it does
support other GNU attributes.  __declspec(dllexport) and
__attribute__((visibility("default"))) are synonyms on SymbianOS.  It
would be odd for them to be different because dllexport is defined in
terms of visibility.  It seems unlikely to me that RealView would add
the visibility attribute but disallow usage that is valid with the
__declspec syntax, but, of course, I can't speak for ARM.

Mark Mitchell
(650) 331-3385 x713

More information about the Gcc mailing list