Skip to content

Commit aea7c1d

Browse files
committed
Sets default symbol visibility to hidden. Resolves #74
1 parent f61e6a3 commit aea7c1d

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
@@ -74,7 +74,7 @@ if(MSVC)
7474
elseif(CMAKE_CXX_COMPILER_ID MATCHES "Clang" OR CMAKE_CXX_COMPILER_ID MATCHES "AppleClang")
7575
# Note: Optionally add -ffunction-sections, -fdata-sections, but with linker option --gc-sections
7676
# TODO: Use link-time optimization -flto. Might require non-default linker.
77-
set(BS_COMPILER_FLAGS_COMMON "-Wall -Wextra -Wno-unused-parameter -fPIC -fno-exceptions -fno-strict-aliasing -fno-rtti -fno-ms-compatibility")
77+
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")
7878

7979
if(LINUX)
8080
set(BS_COMPILER_FLAGS_COMMON "${BS_COMPILER_FLAGS_COMMON} -Wl,-rpath=$ORIGIN")
@@ -94,7 +94,7 @@ elseif(CMAKE_CXX_COMPILER_ID MATCHES "Clang" OR CMAKE_CXX_COMPILER_ID MATCHES "A
9494

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

9999
if(LINUX)
100100
set(BS_COMPILER_FLAGS_COMMON "${BS_COMPILER_FLAGS_COMMON} -Wl,-rpath=$ORIGIN")

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)