js8544 commented on code in PR #37752:
URL: https://github.com/apache/arrow/pull/37752#discussion_r1356034059


##########
cpp/src/gandiva/exported_funcs_registry.h:
##########
@@ -21,34 +21,31 @@
 #include <vector>
 
 #include <gandiva/engine.h>
+#include <gandiva/visibility.h>
 
 namespace gandiva {
 
 class ExportedFuncsBase;
 
 /// Registry for classes that export functions which can be accessed by
 /// LLVM/IR code.
-class ExportedFuncsRegistry {
+class GANDIVA_EXPORT ExportedFuncsRegistry {
  public:
   using list_type = std::vector<std::shared_ptr<ExportedFuncsBase>>;
 
   // Add functions from all the registered classes to the engine.
   static void AddMappings(Engine* engine);
 
   static bool Register(std::shared_ptr<ExportedFuncsBase> entry) {
-    registered().push_back(entry);
+    registered()->emplace_back(std::move(entry));
     return true;
   }
 
- private:
-  static list_type& registered() {
-    static list_type registered_list;
-    return registered_list;
-  }
+  static list_type* registered();

Review Comment:
   Sorry I didn't notice this previously. Is it possible to keep registered() 
as private and add a new public function
   `static const list_type& Registered()`? It will be safer if the mutable 
instance is not exposed to users and they can still access a const reference.



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