lidavidm commented on code in PR #47413:
URL: https://github.com/apache/arrow/pull/47413#discussion_r2299369524


##########
cpp/src/arrow/flight/meson.build:
##########
@@ -52,14 +52,29 @@ fs = import('fs')
 protoc = find_program('protoc')
 
 flight_proto_path = fs.parent(meson.project_source_root()) / 'format'
+
+# To ensure messages from proto files are created correctly, we need to
+# pass in dllexport_decl=<...> . Unfortunately, it doesn't appear that we
+# can just pass in dllexport_decl=ARROW_FLIGHT_EXPORT, as the visibility
+# macro won't be easily available to the generated proto file. See also
+# https://github.com/protocolbuffers/protobuf/issues/19422
+if cpp_compiler.get_id() == 'msvc'
+    proto_visibility = '__declspec(dllexport)'
+else
+    proto_visibility = '__attribute__((visibility("default")))'
+endif
+
 flight_proto_files = custom_target(
     'arrow-flight-proto-files',
     input: [flight_proto_path / 'Flight.proto'],
     output: ['Flight.pb.cc', 'Flight.pb.h'],
     command: [
         protoc,
         '--proto_path=' + flight_proto_path,
-        '--cpp_out=' + meson.current_build_dir(),
+        '--cpp_out=dllexport_decl=@0@:@1@'.format(

Review Comment:
   IIRC every time I've tried, it's turned out that `protoc` doesn't actually 
insert the dllexport declarations in the right places and you get something 
unusable



##########
cpp/src/arrow/flight/meson.build:
##########
@@ -52,14 +52,29 @@ fs = import('fs')
 protoc = find_program('protoc')
 
 flight_proto_path = fs.parent(meson.project_source_root()) / 'format'
+
+# To ensure messages from proto files are created correctly, we need to
+# pass in dllexport_decl=<...> . Unfortunately, it doesn't appear that we
+# can just pass in dllexport_decl=ARROW_FLIGHT_EXPORT, as the visibility
+# macro won't be easily available to the generated proto file. See also
+# https://github.com/protocolbuffers/protobuf/issues/19422
+if cpp_compiler.get_id() == 'msvc'
+    proto_visibility = '__declspec(dllexport)'
+else
+    proto_visibility = '__attribute__((visibility("default")))'
+endif
+
 flight_proto_files = custom_target(
     'arrow-flight-proto-files',
     input: [flight_proto_path / 'Flight.proto'],
     output: ['Flight.pb.cc', 'Flight.pb.h'],
     command: [
         protoc,
         '--proto_path=' + flight_proto_path,
-        '--cpp_out=' + meson.current_build_dir(),
+        '--cpp_out=dllexport_decl=@0@:@1@'.format(

Review Comment:
   But maybe it's fixed now?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to