diff options
Diffstat (limited to 'mesalib/src/util/macros.h')
-rw-r--r-- | mesalib/src/util/macros.h | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/mesalib/src/util/macros.h b/mesalib/src/util/macros.h index eec8b9352..b862bfd5f 100644 --- a/mesalib/src/util/macros.h +++ b/mesalib/src/util/macros.h @@ -156,4 +156,27 @@ do { \ # endif #endif +/** + * PUBLIC/USED macros + * + * If we build the library with gcc's -fvisibility=hidden flag, we'll + * use the PUBLIC macro to mark functions that are to be exported. + * + * We also need to define a USED attribute, so the optimizer doesn't + * inline a static function that we later use in an alias. - ajax + */ +#ifndef PUBLIC +# if defined(__GNUC__) || (defined(__SUNPRO_C) && (__SUNPRO_C >= 0x590)) +# define PUBLIC __attribute__((visibility("default"))) +# define USED __attribute__((used)) +# elif defined(_MSC_VER) +# define PUBLIC __declspec(dllexport) +# define USED +# else +# define PUBLIC +# define USED +# endif +#endif + + #endif /* UTIL_MACROS_H */ |