Skip to content

build: give BlocksRuntime hidden visibility #394

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,9 @@ if(NOT BlocksRuntime_FOUND)
${PROJECT_SOURCE_DIR}/src/BlocksRuntime/runtime.c)
set_target_properties(BlocksRuntime
PROPERTIES
POSITION_INDEPENDENT_CODE TRUE)
POSITION_INDEPENDENT_CODE TRUE
C_VISIBILITY_PRESET HIDDEN
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This won't work as it only sets the default visibility (-fvisibility=hidden), source files can still override it with __attribute__(visibility("default")) (which the BLOCK_EXPORT macro defines).

In fact this is already set on line 20: 1eee0f9#diff-af3b638bc2a3e6c650974192a53c7291R20

Since your ultimate goal is one BlocksRuntime per program, have you considered removing STATIC from the add_library(BlocksRuntime) command above? I think that would result in a BlocksRuntime that respects BUILD_SHARED_LIBS. You should also make sure to install it, e.g.

install(TARGETS BlocksRuntime DESTINATION "${INSTALL_TARGET_LIBDIR}")

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, there is already a PR for that (and this was meant as a stop gap until we get that merged. Since we discussed that we are going to actively pursue that first, this is no longer relevant.

VISIBILITY_INLINES_HIDDEN YES)
if(HAVE_OBJC AND CMAKE_DL_LIBS)
set_target_properties(BlocksRuntime
PROPERTIES
Expand Down