From 5ac51f48a217bfa7291b65cf2a85d597b0df311c Mon Sep 17 00:00:00 2001 From: ffratila <63245333+ffratila@users.noreply.github.com> Date: Wed, 15 Jan 2025 12:47:44 +0200 Subject: [PATCH] Fix hiredis_cluster_ssl build on Windows (#253) * Export all symbols for both libraries on Windows * Remove reference to deleted .def file * Enable non-const connect callback API on Windows --- CMakeLists.txt | 8 +++--- CONTRIBUTING.md | 4 --- hircluster.h | 6 ++--- hiredis_cluster.def | 62 --------------------------------------------- 4 files changed, 7 insertions(+), 73 deletions(-) delete mode 100644 hiredis_cluster.def diff --git a/CMakeLists.txt b/CMakeLists.txt index 6fc039e3..4aa669c5 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -53,9 +53,6 @@ SET(hiredis_cluster_sources if(WIN32 OR MINGW) add_compile_definitions(_CRT_SECURE_NO_WARNINGS WIN32_LEAN_AND_MEAN) - set(hiredis_cluster_sources - ${hiredis_cluster_sources} - hiredis_cluster.def) endif() add_library(hiredis_cluster @@ -73,6 +70,7 @@ endif() set_target_properties(hiredis_cluster PROPERTIES + WINDOWS_EXPORT_ALL_SYMBOLS TRUE VERSION "${HIREDIS_CLUSTER_SONAME}") if(DOWNLOAD_HIREDIS) @@ -167,7 +165,9 @@ if(ENABLE_SSL) add_library(hiredis_cluster_ssl SHARED hircluster_ssl.c) set_target_properties(hiredis_cluster_ssl - PROPERTIES VERSION "${HIREDIS_CLUSTER_SONAME}") + PROPERTIES + WINDOWS_EXPORT_ALL_SYMBOLS TRUE + VERSION "${HIREDIS_CLUSTER_SONAME}") target_link_libraries(hiredis_cluster_ssl PRIVATE hiredis_cluster PUBLIC hiredis::hiredis_ssl) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 47349085..e5137d7e 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -50,10 +50,6 @@ tests using printouts, try `make CTEST_OUTPUT_ON_FAILURE=1 test` or call `ctest` directly with your prefered args, such as `-V` (check the manpage for ctest), in your CMake build directory. -If you have problems with the linker not finding certain functions in the -Windows builds, try adding those functions to the file `hiredis_cluster.def`. -All functions called from the tests need to be in this file. - ## Submitting changes * Run the formatter before committing when contributing to this project (`make format`). diff --git a/hircluster.h b/hircluster.h index 88ea42ec..5b2480b2 100644 --- a/hircluster.h +++ b/hircluster.h @@ -71,9 +71,9 @@ #define HIRCLUSTER_EVENT_FREE_CONTEXT 3 /* The non-const connect callback API is not available when: - * - using hiredis prior v.1.1.0; or - * - built on Windows since hiredis_cluster.def can't have conditional definitions. */ -#if !(HIREDIS_MAJOR >= 1 && HIREDIS_MINOR >= 1) || _WIN32 + * - using hiredis prior v.1.1.0; + */ +#if !(HIREDIS_MAJOR >= 1 && HIREDIS_MINOR >= 1) #define HIRCLUSTER_NO_NONCONST_CONNECT_CB #endif diff --git a/hiredis_cluster.def b/hiredis_cluster.def deleted file mode 100644 index a50b3b1b..00000000 --- a/hiredis_cluster.def +++ /dev/null @@ -1,62 +0,0 @@ - EXPORTS - actx_get_by_node - command_destroy - command_get - ctx_get_by_node - dictInitIterator - dictNext - hiarray_get - parse_cluster_nodes - parse_cluster_slots - redisClusterAppendCommand - redisClusterAppendCommandArgv - redisClusterAppendCommandToNode - redisClusterAppendFormattedCommand - redisClusterAsyncContextInit - redisClusterAsyncCommand - redisClusterAsyncCommandArgv - redisClusterAsyncCommandArgvToNode - redisClusterAsyncCommandToNode - redisClusterAsyncConnect - redisClusterAsyncConnect2 - redisClusterAsyncDisconnect - redisClusterAsyncFormattedCommand - redisClusterAsyncFormattedCommandToNode - redisClusterAsyncFree - redisClusterAsyncSetConnectCallback - redisClusterAsyncSetDisconnectCallback - redisClusterCommand - redisClusterCommandArgv - redisClusterCommandToNode - redisClusterConnect - redisClusterConnect2 - redisClusterConnectWithTimeout - redisClusterContextInit - redisClusterFormattedCommand - redisClusterFree - redisClusterGetNodeByKey - redisClusterGetReply - redisClusterGetSlotByKey - redisClusterInitNodeIterator - redisClusterNodeNext - redisClusterReset - redisClusterSetConnectCallback - redisClusterSetEventCallback - redisClusterSetMaxRedirect - redisClusterSetOptionAddNode - redisClusterSetOptionAddNodes - redisClusterSetOptionConnectBlock - redisClusterSetOptionConnectNonBlock - redisClusterSetOptionConnectTimeout - redisClusterSetOptionMaxRetry - redisClusterSetOptionParseOpenSlots - redisClusterSetOptionParseSlaves - redisClusterSetOptionRouteUseSlots - redisClusterSetOptionTimeout - redisClusterSetOptionUsername - redisClusterSetOptionPassword - redisClusterUpdateSlotmap - redisClustervAppendCommand - redisClustervAsyncCommand - redisClustervCommand - redis_parse_cmd