diff options
| author | Peter0x44 <[email protected]> | 2023-11-28 19:43:45 +0000 |
|---|---|---|
| committer | GitHub <[email protected]> | 2023-11-28 20:43:45 +0100 |
| commit | e7a486fa81adac1833253c849ca73c5b3f7ef361 (patch) | |
| tree | 7c2dd970d41272133d35396d888bb388fb717d7e /src/raylib.h | |
| parent | fe53ba80dd684c501eb1c6d297fbf842bb42e515 (diff) | |
| download | raylib-e7a486fa81adac1833253c849ca73c5b3f7ef361.tar.gz raylib-e7a486fa81adac1833253c849ca73c5b3f7ef361.zip | |
Hide unneeded internal symbols when building raylib as an so or dylib (#3573)
Diffstat (limited to 'src/raylib.h')
| -rw-r--r-- | src/raylib.h | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/src/raylib.h b/src/raylib.h index 28f052c7..2bbbef00 100644 --- a/src/raylib.h +++ b/src/raylib.h @@ -86,17 +86,22 @@ #define RAYLIB_VERSION_PATCH 0 #define RAYLIB_VERSION "5.1-dev" -// Function specifiers in case library is build/used as a shared library (Windows) +// Function specifiers in case library is build/used as a shared library // NOTE: Microsoft specifiers to tell compiler that symbols are imported/exported from a .dll +// NOTE: visibility("default") attribute makes symbols "visible" when compiled with -fvisibility=hidden #if defined(_WIN32) + #if defined(__TINYC__) + #define __declspec(x) __attribute__((x)) + #endif #if defined(BUILD_LIBTYPE_SHARED) - #if defined(__TINYC__) - #define __declspec(x) __attribute__((x)) - #endif #define RLAPI __declspec(dllexport) // We are building the library as a Win32 shared library (.dll) #elif defined(USE_LIBTYPE_SHARED) #define RLAPI __declspec(dllimport) // We are using the library as a Win32 shared library (.dll) #endif +#else + #if defined(BUILD_LIBTYPE_SHARED) + #define RLAPI __attribute__((visibility("default"))) // We are building as a Unix shared library (.so/.dylib) + #endif #endif #ifndef RLAPI |
