RFC: Make dllimport/dllexport imply default visibility

Bill Wendling wendling@apple.com
Fri Jun 15 22:40:00 GMT 2007


On Jun 15, 2007, at 12:48 AM, Mark Mitchell wrote:

> Consider:
>
>  struct __attribute__((vsibility ("hidden"))) S {
>    void __declspec(dllimport) f();
>  };
>
> At present, we give "f" hidden visibility.  That seems odd since the
> user has explicitly told us that the symbol is coming from another
> shared library.
>
> I'm planning to make any dllimport or dllexport attribute imply  
> default
> visibility.  Is that a bad idea?
>
Perhaps I'm mistaken, but the above seems to indicate to me that the  
structure (and, therefore, all of its fields) are hidden, one of its  
functions is from an external and visible source. Because nothing  
outside of the translation unit that has S can access f directly (only  
through a function pointer), I don't see a problem with marking it as  
a hidden part of S. That is, as long as it doesn't affect the original  
f()'s visibility.

I'll ask the opposite question: what would be gained by giving this  
default visibility?

-bw



More information about the Gcc mailing list