Skip to content

Commit

Permalink
Sets default symbol visibility to hidden. Resolves #74
Browse files Browse the repository at this point in the history
  • Loading branch information
jonesmz committed May 8, 2018
1 parent dc748fb commit 073d053
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 8 deletions.
4 changes: 2 additions & 2 deletions Source/CMake/Properties.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ if(MSVC)
elseif(CMAKE_CXX_COMPILER_ID MATCHES "Clang" OR CMAKE_CXX_COMPILER_ID MATCHES "AppleClang")
# Note: Optionally add -ffunction-sections, -fdata-sections, but with linker option --gc-sections
# TODO: Use link-time optimization -flto. Might require non-default linker.
set(BS_COMPILER_FLAGS_COMMON "-Wall -Wextra -Wno-unused-parameter -fPIC -fno-exceptions -fno-strict-aliasing -fno-rtti -fno-ms-compatibility")
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")

if(LINUX)
set(BS_COMPILER_FLAGS_COMMON "${BS_COMPILER_FLAGS_COMMON} -Wl,-rpath=$ORIGIN")
Expand All @@ -96,7 +96,7 @@ elseif(CMAKE_CXX_COMPILER_ID MATCHES "Clang" OR CMAKE_CXX_COMPILER_ID MATCHES "A

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

if(LINUX)
set(BS_COMPILER_FLAGS_COMMON "${BS_COMPILER_FLAGS_COMMON} -Wl,-rpath=$ORIGIN")
Expand Down
11 changes: 5 additions & 6 deletions Source/Foundation/bsfUtility/Allocators/BsMemoryAllocator.h
Original file line number Diff line number Diff line change
Expand Up @@ -100,25 +100,24 @@ namespace bs
* Thread safe class used for storing total number of memory allocations and deallocations, primarily for statistic
* purposes.
*/
class MemoryCounter
class BS_UTILITY_EXPORT MemoryCounter
{
public:
static BS_UTILITY_EXPORT uint64_t getNumAllocs()
static uint64_t getNumAllocs()
{
return Allocs;
}

static BS_UTILITY_EXPORT uint64_t getNumFrees()
static uint64_t getNumFrees()
{
return Frees;
}

private:
friend class MemoryAllocatorBase;

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

static BS_THREADLOCAL uint64_t Allocs;
static BS_THREADLOCAL uint64_t Frees;
Expand Down

0 comments on commit 073d053

Please sign in to comment.