proper use of __attribute__((visibility("hidden")))

Jeffrey Holle jeffreyholle@bellsouth.net
Thu Jan 11 21:37:00 GMT 2007


I found the following #define artifact on 
http://gcc.gnu.org/wiki/Visibility.

This suggests that while the Microsoft standard requires an 
using/building concept, but gcc doesn't.

However, I've found an email on this newsgroup that suggests that the 
"using" code should see a macro that is empty, not "__attribute__ 
((visibility("hidden")))".

Which is correct?


#ifdef _MSC_VER
   #ifdef BUILDING_DLL
     #define DLLEXPORT __declspec(dllexport)
   #else
     #define DLLEXPORT __declspec(dllimport)
   #endif
   #define DLLLOCAL
#else
   #ifdef HAVE_GCCVISIBILITYPATCH
     #define DLLEXPORT __attribute__ ((visibility("default")))
     #define DLLLOCAL __attribute__ ((visibility("hidden")))
   #else
     #define DLLEXPORT
     #define DLLLOCAL
   #endif
#endif



More information about the Gcc-help mailing list