Skip to content

Commit 6199c78

Browse files
committed
GH-47429: [C++] Fix Flight Symbol Visibility on Windows
1 parent de52048 commit 6199c78

File tree

3 files changed

+15
-6
lines changed

3 files changed

+15
-6
lines changed

.github/workflows/cpp.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -300,7 +300,7 @@ jobs:
300300
ARROW_BUILD_STATIC: OFF
301301
ARROW_BUILD_TESTS: ON
302302
ARROW_DATASET: ON
303-
ARROW_FLIGHT: OFF
303+
ARROW_FLIGHT: ON
304304
ARROW_HDFS: ON
305305
ARROW_HOME: /usr
306306
ARROW_JEMALLOC: OFF

cpp/src/arrow/flight/CMakeLists.txt

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,10 +104,23 @@ set(FLIGHT_PROTOC_COMMAND ${ARROW_PROTOBUF_PROTOC} "-I${FLIGHT_PROTO_PATH}")
104104
if(Protobuf_VERSION VERSION_LESS 3.15)
105105
list(APPEND FLIGHT_PROTOC_COMMAND "--experimental_allow_proto3_optional")
106106
endif()
107+
108+
if(MSVC)
109+
if(ARROW_BUILD_STATIC)
110+
set(FLIGHT_PROTOC_VISIBILITY "")
111+
else()
112+
set(FLIGHT_PROTOC_VISIBILITY "dllexport_decl=__declspec(dllexport):")
113+
endif()
114+
else()
115+
set(FLIGHT_PROTOC_VISIBILITY
116+
"dllexport_decl=__attribute__((visibility(\\\"default\\\"))):")
117+
endif()
118+
107119
add_custom_command(OUTPUT ${FLIGHT_GENERATED_PROTO_FILES}
108120
DEPENDS ${PROTO_DEPENDS} ARGS
109121
COMMAND ${FLIGHT_PROTOC_COMMAND}
110-
"--cpp_out=${CMAKE_CURRENT_BINARY_DIR}" "${FLIGHT_PROTO}"
122+
"--cpp_out=${FLIGHT_PROTOC_VISIBILITY}${CMAKE_CURRENT_BINARY_DIR}"
123+
"${FLIGHT_PROTO}"
111124
COMMAND ${FLIGHT_PROTOC_COMMAND}
112125
"--grpc_out=${CMAKE_CURRENT_BINARY_DIR}"
113126
"--plugin=protoc-gen-grpc=$<TARGET_FILE:gRPC::grpc_cpp_plugin>"

cpp/src/arrow/flight/flight_internals_test.cc

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -702,7 +702,6 @@ TEST_F(TestCookieParsing, CookieCache) {
702702
// Protobuf tests
703703

704704
TEST(GrpcTransport, FlightDataDeserialize) {
705-
#ifndef _WIN32
706705
pb::FlightData raw;
707706
// Tack on known and unknown fields by hand here
708707
raw.GetReflection()->MutableUnknownFields(&raw)->AddFixed32(900, 1024);
@@ -725,9 +724,6 @@ TEST(GrpcTransport, FlightDataDeserialize) {
725724
ASSERT_EQ("data", out.body->ToString());
726725

727726
grpc_slice_unref(slice);
728-
#else
729-
GTEST_SKIP() << "Can't use Protobuf symbols on Windows";
730-
#endif
731727
}
732728

733729
// ----------------------------------------------------------------------

0 commit comments

Comments
 (0)