From 7a432775f1bcf680c1c77e101ddbc405fb6a70da Mon Sep 17 00:00:00 2001 From: JP Cimalando Date: Mon, 30 Jul 2018 09:25:41 +0200 Subject: hide private symbols --- CMakeLists.txt | 11 +++++++++++ src/adlmidi_private.hpp | 2 +- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index ab3e7e5..8d1fad6 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -65,6 +65,15 @@ function(set_legacy_standard destTarget) endif() endif() endfunction() + +function(set_visibility_hidden destTarget) + if(CMAKE_C_COMPILER_ID MATCHES "^(GNU|Clang)$") + target_compile_options(${destTarget} PRIVATE + -fvisibility=hidden -fvisibility-inlines-hidden) + target_compile_definitions(${destTarget} PRIVATE + "LIBADLMIDI_VISIBILITY") + endif() +endfunction() #=========================================================================================== option(libADLMIDI_STATIC "Build static library of libADLMIDI" ON) @@ -273,6 +282,7 @@ if(libADLMIDI_STATIC) set_target_properties(ADLMIDI_static PROPERTIES OUTPUT_NAME ADLMIDI) target_include_directories(ADLMIDI_static PUBLIC ${libADLMIDI_SOURCE_DIR}/include) set_legacy_standard(ADLMIDI_static) + set_visibility_hidden(ADLMIDI_static) list(APPEND libADLMIDI_INSTALLS ADLMIDI_static) if(WITH_EMBEDDED_BANKS AND WITH_GENADLDATA) add_dependencies(ADLMIDI_static gen-adldata-run) @@ -284,6 +294,7 @@ if(libADLMIDI_SHARED) set_target_properties(ADLMIDI_shared PROPERTIES OUTPUT_NAME ADLMIDI) target_include_directories(ADLMIDI_shared PUBLIC ${libADLMIDI_SOURCE_DIR}/include) set_legacy_standard(ADLMIDI_shared) + set_visibility_hidden(ADLMIDI_shared) list(APPEND libADLMIDI_INSTALLS ADLMIDI_shared) if(WITH_EMBEDDED_BANKS AND WITH_GENADLDATA) add_dependencies(ADLMIDI_shared gen-adldata-run) diff --git a/src/adlmidi_private.hpp b/src/adlmidi_private.hpp index 9687023..eee73ac 100644 --- a/src/adlmidi_private.hpp +++ b/src/adlmidi_private.hpp @@ -28,7 +28,7 @@ #ifndef ADLMIDI_EXPORT # if defined (_WIN32) && defined(ADLMIDI_BUILD_DLL) # define ADLMIDI_EXPORT __declspec(dllexport) -# elif defined (LIBADLMIDI_VISIBILITY) +# elif defined (LIBADLMIDI_VISIBILITY) && defined (__GNUC__) # define ADLMIDI_EXPORT __attribute__((visibility ("default"))) # else # define ADLMIDI_EXPORT -- cgit v1.2.3 From 99556c7916f32a8ed80a8e303ff92142570209dd Mon Sep 17 00:00:00 2001 From: Vitaly Novichkov Date: Mon, 30 Jul 2018 12:46:05 +0300 Subject: Added missing macro for DLL build The macro `ADLMIDI_BUILD_DLL` tells to use the `dllexport` attribute for public symbols. It's required, otherwise, symbol will not be available. --- CMakeLists.txt | 3 +++ 1 file changed, 3 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index 8d1fad6..2d4cec2 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -296,6 +296,9 @@ if(libADLMIDI_SHARED) set_legacy_standard(ADLMIDI_shared) set_visibility_hidden(ADLMIDI_shared) list(APPEND libADLMIDI_INSTALLS ADLMIDI_shared) + if(WIN32) + target_compile_definitions(ADLMIDI_shared PRIVATE "-DADLMIDI_BUILD_DLL") + endif() if(WITH_EMBEDDED_BANKS AND WITH_GENADLDATA) add_dependencies(ADLMIDI_shared gen-adldata-run) endif() -- cgit v1.2.3 From 9bd0a7edac19860ead160bf8ea693927924f8f27 Mon Sep 17 00:00:00 2001 From: JP Cimalando Date: Mon, 30 Jul 2018 16:36:20 +0200 Subject: remove an exported function which is unused --- src/adlmidi.cpp | 5 ----- 1 file changed, 5 deletions(-) diff --git a/src/adlmidi.cpp b/src/adlmidi.cpp index d839399..5564404 100644 --- a/src/adlmidi.cpp +++ b/src/adlmidi.cpp @@ -660,11 +660,6 @@ ADLMIDI_EXPORT const char *adl_errorInfo(struct ADL_MIDIPlayer *device) return play->getErrorString().c_str(); } -ADLMIDI_EXPORT const char *adl_getMusicTitle(struct ADL_MIDIPlayer *device) -{ - return adl_metaMusicTitle(device); -} - ADLMIDI_EXPORT void adl_reset(struct ADL_MIDIPlayer *device) { if(!device) -- cgit v1.2.3