Rethink static plugins initialization #2088
Replies: 2 comments
-
Proposal 2 When static plugins are enabled, all the dynamic plugin stuff should be disabled, no .ini scanning, no dlopen/dlclose, etc. does this proposal fix all issues? if so, it looks like a good solution |
Beta Was this translation helpful? Give feedback.
-
Probably I did not explain this in the right way, I intended this as 2 separate proposals that fix different issues, both related to static libraries, not different alternatives. This is an easy fix, but the other proposal requires some work... Unfortunately proposal 2 does not solve a big issue, it is just to fix this point:
Also I think that if you want to use static libraries, either you don't have the support for dynamic libraries on the system, or you explicitly want to use static libraries only for some reason. Therefore the |
Beta Was this translation helpful? Give feedback.
-
Rationale
YARP_init
library has the only goal to load static plugins whenever the network is initializedyarpcar
andyarpmod
libraries, which means that even if you want to use static plugins because you have limited resources, you will have all plugins linked, even if you use only one of them, and the compiler cannot remove them, because the symbols are usedYARP_init
library complicates a lot the CMake part of YARP, and, causes recursive dependencies, and forces weird tricks to make it work.YARP_init
library is unclear to most people, and not easy to explainProposal 1
I'd like to change current implementation, by changing current initialization with a manual one, for example something like this:
From:
To:
Pros
Cons
YARP_init
is linked explicitly, it needs to be removed, since it will cease to exist (it could become an alias toYARP_OS
, though, but there is no way to produce a deprecation warning)Alternatives
The
yarp_import_plugin
/yarp_import_plugin_collection
commands could create aCustomInit.cpp
-like file specific for the case, and add it to the sources of thefoo
target.This would still require to create one for dynamic only plugins, that's why I don't think it is worth implementing this solution
Proposal 2
When static plugins are enabled, all the dynamic plugin stuff should be disabled, no
.ini
scanning, no dlopen/dlclose, etc.Beta Was this translation helpful? Give feedback.
All reactions