Am 28.05.2012 11:27, schrieb Frank Lanitz:
It's important to note that the dynamic library loading mechanism that loads plugins is C functionality and does not know about C++ constructors. This means that global and static objects in the plugin will *not* have their constructors called when the plugin is loaded. Use dynamically created objects as show in the above example.
I'm not sure this is true. libdl should handle this (i.e. call functions point to in the init and fini sections).
|__attribute__ ((constructor)) and||__attribute__ ((destructor)) is supported works with as well.
Best regards. |