Skip to content

Commit 3e2e198

Browse files
committed
[c] support dynamic loading on Windows: test
1 parent d8595fe commit 3e2e198

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

test/dynamic_loading/CMakeLists.txt

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,11 @@ target_link_libraries(
3232
# ENABLE_EXPORTS is required so that symbols from each shared library are
3333
# visible to other shared libraries loaded at runtime (e.g. dl_test_overrider
3434
# can resolve symbols from dl_test_method/dl_test_registry).
35+
# CXX_VISIBILITY_PRESET must be "default" so that the template static variables
36+
# used as the shared registry state (policy statics) are exported with DEFAULT
37+
# ELF visibility. With hidden visibility (as set by BoostRoot.cmake in the
38+
# super-project build) they become UNIQUE HIDDEN and are not deduplicated by
39+
# the dynamic linker, breaking cross-DSO state sharing.
3540
foreach(
3641
target dl_test_registry dl_test_method dl_test_overrider
3742
boost_openmethod-test_dynamic_loading)
@@ -41,7 +46,9 @@ foreach(
4146
RUNTIME_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}"
4247
LIBRARY_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}"
4348
ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}"
44-
ENABLE_EXPORTS ON)
49+
ENABLE_EXPORTS ON
50+
CXX_VISIBILITY_PRESET default
51+
VISIBILITY_INLINES_HIDDEN OFF)
4552
endforeach()
4653

4754
add_test(

0 commit comments

Comments
 (0)