Alan Coopersmith wrote:
> Yes - in X code, we use these macros to allow compiling with gcc,
> Sun Studio, or other compilers:
> 
> #if defined(__GNUC__) && ((__GNUC__ * 100 + __GNUC_MINOR__) >= 303)
> # define _X_EXPORT      __attribute__((visibility("default")))
> # define _X_HIDDEN      __attribute__((visibility("hidden")))
> # define _X_INTERNAL    __attribute__((visibility("internal")))
> #elif defined(__SUNPRO_C) && (__SUNPRO_C >= 0x550)
> # define _X_EXPORT      __global
> # define _X_HIDDEN      __hidden
> # define _X_INTERNAL    __hidden
> #else /* not gcc >= 3.3 and not Sun Studio >= 8 */
> # define _X_EXPORT
> # define _X_HIDDEN
> # define _X_INTERNAL
> #endif
> 
> It does require making sure the macro is used at the beginning of
> the declaration as Sun Studio requires, instead of the end as gcc
> allows, but you can write code acceptable to both like this:
> _X_HIDDEN int
> xf86KbdOn(void)
> {
> ...
> 
> You can also just use linker mapfiles with all compilers as well,
> but that may not be as portable to other OS'es.
> 
>     -Alan Coopersmith-           alan.coopersmith at sun.com
>      Sun Microsystems, Inc. - X Window System Engineering


This looks like something that should be be part of Solaris, doesn't
it?

- Bart

Bart Smaalders                  Solaris Kernel Performance
barts at cyber.eng.sun.com              http://blogs.sun.com/barts

Reply via email to