diff --git a/platform/unix/configure.ac b/platform/unix/configure.ac index 8f5c6be26..fd639a91e 100644 --- a/platform/unix/configure.ac +++ b/platform/unix/configure.ac @@ -29,6 +29,10 @@ AC_DEFUN([LOVE_MSG_ERROR], # C++14 support in cpp14.m4 ACLOVE_CPP14_TEST +# Add -fvisibility=hidden and -fvisibility-inlines-hidden +CFLAGS="-fvisibility=hidden $CFLAGS" +CPPFLAGS="-fvisibility=hidden -fvisibility-inlines-hidden $CPPFLAGS" + # Allow people on OSX to use autotools, they need their platform files AC_ARG_ENABLE([osx], AC_HELP_STRING([--enable-osx], [Compile platform-specific files for OSX]), [], [enable_osx=no]) diff --git a/platform/xcode/liblove.xcodeproj/project.pbxproj b/platform/xcode/liblove.xcodeproj/project.pbxproj index 04bfbdc69..0c381c415 100644 --- a/platform/xcode/liblove.xcodeproj/project.pbxproj +++ b/platform/xcode/liblove.xcodeproj/project.pbxproj @@ -5461,6 +5461,7 @@ GCC_NO_COMMON_BLOCKS = YES; GCC_OPTIMIZATION_LEVEL = 3; GCC_PREPROCESSOR_DEFINITIONS = LOVE_APPLE_USE_FRAMEWORKS; + GCC_SYMBOLS_PRIVATE_EXTERN = YES; GCC_WARN_64_TO_32_BIT_CONVERSION = NO; GCC_WARN_ABOUT_MISSING_FIELD_INITIALIZERS = YES; GCC_WARN_ABOUT_MISSING_NEWLINE = YES; @@ -5526,6 +5527,7 @@ LOVE_APPLE_USE_FRAMEWORKS, "DEBUG=1", ); + GCC_SYMBOLS_PRIVATE_EXTERN = YES; GCC_WARN_64_TO_32_BIT_CONVERSION = NO; GCC_WARN_ABOUT_MISSING_FIELD_INITIALIZERS = YES; GCC_WARN_ABOUT_MISSING_NEWLINE = YES; @@ -5663,6 +5665,7 @@ GCC_NO_COMMON_BLOCKS = YES; GCC_OPTIMIZATION_LEVEL = 3; GCC_PREPROCESSOR_DEFINITIONS = LOVE_APPLE_USE_FRAMEWORKS; + GCC_SYMBOLS_PRIVATE_EXTERN = YES; GCC_WARN_64_TO_32_BIT_CONVERSION = NO; GCC_WARN_ABOUT_MISSING_FIELD_INITIALIZERS = YES; GCC_WARN_ABOUT_MISSING_NEWLINE = YES; diff --git a/platform/xcode/love.xcodeproj/project.pbxproj b/platform/xcode/love.xcodeproj/project.pbxproj index 418f8d202..e91c5bec8 100644 --- a/platform/xcode/love.xcodeproj/project.pbxproj +++ b/platform/xcode/love.xcodeproj/project.pbxproj @@ -531,6 +531,7 @@ GCC_NO_COMMON_BLOCKS = YES; GCC_OPTIMIZATION_LEVEL = 0; GCC_PREPROCESSOR_DEFINITIONS = LOVE_APPLE_USE_FRAMEWORKS; + GCC_SYMBOLS_PRIVATE_EXTERN = YES; GCC_TREAT_IMPLICIT_FUNCTION_DECLARATIONS_AS_ERRORS = NO; GCC_WARN_64_TO_32_BIT_CONVERSION = NO; GCC_WARN_ABOUT_MISSING_NEWLINE = NO; @@ -603,6 +604,7 @@ GCC_NO_COMMON_BLOCKS = YES; GCC_OPTIMIZATION_LEVEL = 3; GCC_PREPROCESSOR_DEFINITIONS = LOVE_APPLE_USE_FRAMEWORKS; + GCC_SYMBOLS_PRIVATE_EXTERN = YES; GCC_TREAT_IMPLICIT_FUNCTION_DECLARATIONS_AS_ERRORS = NO; GCC_WARN_64_TO_32_BIT_CONVERSION = NO; GCC_WARN_ABOUT_MISSING_NEWLINE = NO; @@ -836,6 +838,7 @@ GCC_NO_COMMON_BLOCKS = YES; GCC_OPTIMIZATION_LEVEL = 3; GCC_PREPROCESSOR_DEFINITIONS = LOVE_APPLE_USE_FRAMEWORKS; + GCC_SYMBOLS_PRIVATE_EXTERN = YES; GCC_TREAT_IMPLICIT_FUNCTION_DECLARATIONS_AS_ERRORS = NO; GCC_WARN_64_TO_32_BIT_CONVERSION = NO; GCC_WARN_ABOUT_MISSING_NEWLINE = NO; diff --git a/src/common/config.h b/src/common/config.h index 373ac4918..2a6067584 100644 --- a/src/common/config.h +++ b/src/common/config.h @@ -102,8 +102,10 @@ #endif // DLL-stuff. -#ifdef LOVE_WINDOWS +#if defined(_MSC_VER) # define LOVE_EXPORT __declspec(dllexport) +#elif defined(__GNUC__) || defined(__clang__) +# define LOVE_EXPORT __attribute__((visibility("default"))) #else # define LOVE_EXPORT #endif diff --git a/src/common/macos.h b/src/common/macos.h index 929de36fc..b26e7e15c 100644 --- a/src/common/macos.h +++ b/src/common/macos.h @@ -38,13 +38,13 @@ namespace macos * in the main bundle (love.app.) * Returns an empty string if no love file is found. **/ -std::string getLoveInResources(); +LOVE_EXPORT std::string getLoveInResources(); /** * Checks for drop-file events. Returns the filepath if an event occurred, or * an empty string otherwise. **/ -std::string checkDropEvents(); +LOVE_EXPORT std::string checkDropEvents(); /** * Bounce the dock icon, if the app isn't in the foreground.