Skip to content

Commit 11e1ee4

Browse files
committed
Sets default symbol visibility to hidden. Resolves #74
1 parent 8002b64 commit 11e1ee4

File tree

2 files changed

+7
-8
lines changed

2 files changed

+7
-8
lines changed

Source/CMake/Properties.cmake

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ if(MSVC)
7777
elseif(CMAKE_CXX_COMPILER_ID MATCHES "Clang" OR CMAKE_CXX_COMPILER_ID MATCHES "AppleClang")
7878
# Note: Optionally add -ffunction-sections, -fdata-sections, but with linker option --gc-sections
7979
# TODO: Use link-time optimization -flto. Might require non-default linker.
80-
set(BS_COMPILER_FLAGS_COMMON "-Wall -Wextra -Wno-unused-parameter -fPIC -fno-exceptions -fno-strict-aliasing -fno-rtti -fno-ms-compatibility")
80+
set(BS_COMPILER_FLAGS_COMMON "-Wall -Wextra -Wno-unused-parameter -fvisibility=hidden -fvisibility-inlines-hidden -fPIC -fno-exceptions -fno-strict-aliasing -fno-rtti -fno-ms-compatibility")
8181

8282
if(APPLE)
8383
set(BS_COMPILER_FLAGS_COMMON "${BS_COMPILER_FLAGS_COMMON} -fobjc-arc -std=c++1z")
@@ -95,7 +95,7 @@ elseif(CMAKE_CXX_COMPILER_ID MATCHES "Clang" OR CMAKE_CXX_COMPILER_ID MATCHES "A
9595

9696
elseif("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU")
9797
# TODO: Use link-time optimization -flto. Might require non-default linker.
98-
set(BS_COMPILER_FLAGS_COMMON "-Wall -Wextra -Wno-unused-parameter -fPIC -fno-exceptions -fno-strict-aliasing -fno-rtti")
98+
set(BS_COMPILER_FLAGS_COMMON "-Wall -Wextra -Wno-unused-parameter -fvisibility=hidden -fvisibility-inlines-hidden -fPIC -fno-exceptions -fno-strict-aliasing -fno-rtti")
9999

100100
set(CMAKE_CXX_FLAGS_DEBUG "${BS_COMPILER_FLAGS_COMMON} -ggdb -O0 -DDEBUG")
101101
set(CMAKE_CXX_FLAGS_OPTIMIZEDDEBUG "${BS_COMPILER_FLAGS_COMMON} -ggdb -O2 -DDEBUG -Wno-unused-variable")

Source/Foundation/bsfUtility/Allocators/BsMemoryAllocator.h

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -100,25 +100,24 @@ namespace bs
100100
* Thread safe class used for storing total number of memory allocations and deallocations, primarily for statistic
101101
* purposes.
102102
*/
103-
class MemoryCounter
103+
class BS_UTILITY_EXPORT MemoryCounter
104104
{
105105
public:
106-
static BS_UTILITY_EXPORT uint64_t getNumAllocs()
106+
static uint64_t getNumAllocs()
107107
{
108108
return Allocs;
109109
}
110110

111-
static BS_UTILITY_EXPORT uint64_t getNumFrees()
111+
static uint64_t getNumFrees()
112112
{
113113
return Frees;
114114
}
115115

116116
private:
117117
friend class MemoryAllocatorBase;
118118

119-
// Threadlocal data can't be exported, so some magic to make it accessible from MemoryAllocator
120-
static BS_UTILITY_EXPORT void incAllocCount() { ++Allocs; }
121-
static BS_UTILITY_EXPORT void incFreeCount() { ++Frees; }
119+
static void incAllocCount() { ++Allocs; }
120+
static void incFreeCount() { ++Frees; }
122121

123122
static BS_THREADLOCAL uint64_t Allocs;
124123
static BS_THREADLOCAL uint64_t Frees;

0 commit comments

Comments
 (0)