szaszm commented on code in PR #2056:
URL: https://github.com/apache/nifi-minifi-cpp/pull/2056#discussion_r2489066238


##########
libminifi/src/core/extension/Extension.cpp:
##########
@@ -78,18 +78,38 @@ bool DynamicLibrary::unload() {
   return true;
 }
 
-void* DynamicLibrary::findSymbol(const char *name) {
+void* Extension::findSymbol(const char *name) {
   if (!handle_) {
     throw std::logic_error("Dynamic library has not been loaded");
   }
   return dlsym(handle_, name);
 }
 
-DynamicLibrary::~DynamicLibrary() = default;
+Extension::~Extension() {
+  if (info_ && info_->deinit) {
+    info_->deinit(info_->user_data);
+  }
+  unload();
+}
+
+bool Extension::initialize(const std::shared_ptr<minifi::Configure>& 
configure) {
+  logger_->log_trace("Initializing extension '{}'", name_);
+  if (void* init = findSymbol("InitExtension")) {
+    logger_->log_debug("Found custom initializer for '{}'", name_);
+    
info_.reset(reinterpret_cast<Info*>(reinterpret_cast<MinifiExtension*(*)(MinifiConfig*)>(init)(reinterpret_cast<MinifiConfig*>(configure.get()))));

Review Comment:
   This line is very complex, can you separate it to different lines, maybe one 
cast each?



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