From 60ccaac64d5159f412f56ee7b303817bce614a0c Mon Sep 17 00:00:00 2001 From: PancakeTAS Date: Wed, 30 Jul 2025 17:46:39 +0200 Subject: [PATCH] fix: hide symbols by default --- CMakeLists.txt | 2 ++ framegen/CMakeLists.txt | 3 +++ framegen/public/lsfg_3_1.hpp | 5 +++++ framegen/public/lsfg_3_1p.hpp | 5 +++++ include/layer.hpp | 2 ++ src/main.cpp | 4 +++- 6 files changed, 20 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index b9ad34f..bcd40a8 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,6 +1,8 @@ cmake_minimum_required(VERSION 3.10) set(CMAKE_SKIP_RPATH ON) +set(CMAKE_C_VISIBILITY_PRESET "hidden") +set(CMAKE_CXX_VISIBILITY_PRESET "hidden") # subprojects add_compile_options(-fPIC diff --git a/framegen/CMakeLists.txt b/framegen/CMakeLists.txt index be88d62..c2e9ac9 100644 --- a/framegen/CMakeLists.txt +++ b/framegen/CMakeLists.txt @@ -1,5 +1,8 @@ cmake_minimum_required(VERSION 3.10) +set(CMAKE_C_VISIBILITY_PRESET "hidden") +set(CMAKE_CXX_VISIBILITY_PRESET "hidden") + project(lsfg-vk-framegen DESCRIPTION "Lossless Scaling Frame Generation Backend" LANGUAGES CXX) diff --git a/framegen/public/lsfg_3_1.hpp b/framegen/public/lsfg_3_1.hpp index ae8b86e..40a60b5 100644 --- a/framegen/public/lsfg_3_1.hpp +++ b/framegen/public/lsfg_3_1.hpp @@ -20,6 +20,7 @@ namespace LSFG_3_1 { /// /// @throws LSFG::vulkan_error if Vulkan objects fail to initialize. /// + __attribute__((visibility("default"))) void initialize(uint64_t deviceUUID, bool isHdr, float flowScale, uint64_t generationCount, const std::function(const std::string&)>& loader); @@ -36,6 +37,7 @@ namespace LSFG_3_1 { /// /// @throws LSFG::vulkan_error if the context cannot be created. /// + __attribute__((visibility("default"))) int32_t createContext( int in0, int in1, const std::vector& outN, VkExtent2D extent, VkFormat format); @@ -49,6 +51,7 @@ namespace LSFG_3_1 { /// /// @throws LSFG::vulkan_error if the context cannot be presented. /// + __attribute__((visibility("default"))) void presentContext(int32_t id, int inSem, const std::vector& outSem); /// @@ -56,11 +59,13 @@ namespace LSFG_3_1 { /// /// @param id Unique identifier of the context to delete. /// + __attribute__((visibility("default"))) void deleteContext(int32_t id); /// /// Deinitialize the LSFG library. /// + __attribute__((visibility("default"))) void finalize(); } diff --git a/framegen/public/lsfg_3_1p.hpp b/framegen/public/lsfg_3_1p.hpp index 27417ce..fb7f725 100644 --- a/framegen/public/lsfg_3_1p.hpp +++ b/framegen/public/lsfg_3_1p.hpp @@ -20,6 +20,7 @@ namespace LSFG_3_1P { /// /// @throws LSFG::vulkan_error if Vulkan objects fail to initialize. /// + __attribute__((visibility("default"))) void initialize(uint64_t deviceUUID, bool isHdr, float flowScale, uint64_t generationCount, const std::function(const std::string&)>& loader); @@ -36,6 +37,7 @@ namespace LSFG_3_1P { /// /// @throws LSFG::vulkan_error if the context cannot be created. /// + __attribute__((visibility("default"))) int32_t createContext( int in0, int in1, const std::vector& outN, VkExtent2D extent, VkFormat format); @@ -49,6 +51,7 @@ namespace LSFG_3_1P { /// /// @throws LSFG::vulkan_error if the context cannot be presented. /// + __attribute__((visibility("default"))) void presentContext(int32_t id, int inSem, const std::vector& outSem); /// @@ -56,11 +59,13 @@ namespace LSFG_3_1P { /// /// @param id Unique identifier of the context to delete. /// + __attribute__((visibility("default"))) void deleteContext(int32_t id); /// /// Deinitialize the LSFG library. /// + __attribute__((visibility("default"))) void finalize(); } diff --git a/include/layer.hpp b/include/layer.hpp index ce12818..6ebe903 100644 --- a/include/layer.hpp +++ b/include/layer.hpp @@ -219,6 +219,8 @@ namespace Layer { } /// Symbol definition for Vulkan instance layer. +__attribute__((visibility("default"))) extern "C" PFN_vkVoidFunction layer_vkGetInstanceProcAddr(VkInstance instance, const char* pName); /// Symbol definition for Vulkan device layer. +__attribute__((visibility("default"))) extern "C" PFN_vkVoidFunction layer_vkGetDeviceProcAddr(VkDevice device, const char* pName); diff --git a/src/main.cpp b/src/main.cpp index ef9eb07..ac16086 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -15,7 +15,9 @@ #include namespace { - __attribute__((constructor)) void lsfgvk_init() { + __attribute__((constructor)) + __attribute__((visibility("default"))) + void lsfgvk_init() { std::cerr << std::unitbuf; // read configuration