-
Notifications
You must be signed in to change notification settings - Fork 24
Description
Original report (archived issue) by Steve Peters (Bitbucket: Steven Peters, GitHub: scpeters).
Migrated from https://osrf-migration.github.io/ignition-gh-pages/#!/ignitionrobotics/ign-common/issues/34/rtld_lazy-vs-rtld_now-in-pluginloader (gazebosim/gz-common#34)
Looking at the PluginLoader
implementation, we're using the RTLD_LAZY
as the flag parameter when calling dlopen
. Here's a description of the available flags.
Based on the documentation and a chat with @mxgrey, we conclude that Ignition Common doesn't have a particular preference between RTLD_LAZY
or RTLD_NOW
. The main implications seem to affect performance. RTLD_NOW
front-loads some of the work when dlopen()
is called at the cost of resolving symbols that might not be used. On the other hand, RTLD_LAZY
returns faster from dlopen()
but it will require to resolve the symbol the first time is really used.
To accommodate the different use cases from the Ignition Common users, we could expose the ability to choose the mode to the users. We discussed two options:
- Expose the flag at the
PluginLoader
class. All subsequent calls toLoadLibrary()
will use the previously set flag. - Expose the flag as a new
LoadLibrary()
parameter (possibly with a default option).