m-kuhn commented on code in PR #719:
URL: https://github.com/apache/arrow-nanoarrow/pull/719#discussion_r1990689047


##########
src/nanoarrow/nanoarrow.h:
##########
@@ -139,6 +139,20 @@
 
 #endif
 
+#if (defined _WIN32 || defined __CYGWIN__) && defined(NANOARROW_BUILD_DLL)
+#if defined(NANOARROW_EXPORT_DLL)
+#define NANOARROW_DLL __declspec(dllexport)
+#else
+#define NANOARROW_DLL __declspec(dllimport)
+#endif  // defined(NANOARROW_EXPORT_DLL)
+#elif !defined(NANOARROW_DLL)
+#if __GNUC__ >= 4
+#define NANOARROW_DLL __attribute__((visibility("default")))
+#else
+#define NANOARROW_DLL
+#endif  // __GNUC__ >= 4
+#endif

Review Comment:
   To avoid keeping this up to date, I would recommend the usage of 
https://cmake.org/cmake/help/latest/module/GenerateExportHeader.html which 
creates this code via cmake.
   
   ```
   set(CMAKE_CXX_VISIBILITY_PRESET hidden)
   set(CMAKE_VISIBILITY_INLINES_HIDDEN 1)
   generate_export_header(nanoarrow)
   
   install(FILES
    ${PROJECT_BINARY_DIR}/nanoarrow_export.h DESTINATION ${INCLUDE_INSTALL_DIR}
   )
   ```
   
   ```
   class NANOARROW_EXPORT SomeClass { ... }
   ```
   
   I do think that with this we get away with one exported target (no 
`nanoarrow_shared` target, or is there a reason we want to install static and 
shared in parallel?) and less boilerplate code to maintain



-- 
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