Skip to content

Commit 4928708

Browse files
authored
Fix symbols export/import for shared libs on windows
1 parent 10f18a5 commit 4928708

2 files changed

Lines changed: 4 additions & 8 deletions

File tree

CMakeLists.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,8 +77,8 @@ if(WIN32 AND MINGW)
7777
target_link_libraries(ImGui-SFML PUBLIC imm32)
7878
endif()
7979
if(BUILD_SHARED_LIBS)
80-
target_compile_definitions(ImGui-SFML PRIVATE IMGUI_SFML_SHARED_LIB)
81-
set_target_properties(ImGui-SFML PROPERTIES DEFINE_SYMBOL "IMGUI_SFML_EXPORTS")
80+
target_compile_definitions(ImGui-SFML PUBLIC IMGUI_SFML_SHARED_LIB
81+
PRIVATE IMGUI_SFML_EXPORTS)
8282
set_target_properties(ImGui-SFML PROPERTIES DEBUG_POSTFIX "_d")
8383
endif()
8484
if(IMGUI_SFML_DISABLE_OBSOLETE_FUNCTIONS)

imgui-SFML_export.h

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,21 +5,17 @@
55
#if _WIN32
66
#ifdef IMGUI_SFML_EXPORTS
77
#define IMGUI_SFML_API __declspec(dllexport)
8-
#define IMGUI_API __declspec(dllexport)
98
#else
109
#define IMGUI_SFML_API __declspec(dllimport)
11-
#define IMGUI_API __declspec(dllexport)
1210
#endif
13-
#elif __GNUC__ >= 4
11+
#elif __GNUC__
1412
#define IMGUI_SFML_API __attribute__((visibility("default")))
15-
#define IMGUI_API __attribute__((visibility("default")))
1613
#else
1714
#define IMGUI_SFML_API
18-
#define IMGUI_API
1915
#endif
2016
#else
2117
#define IMGUI_SFML_API
22-
#define IMGUI_API
2318
#endif
2419

20+
#define IMGUI_API IMGUI_SFML_API
2521
#endif

0 commit comments

Comments
 (0)