On 28 May 2012 19:59, Thomas Martitz thomas.martitz@student.htw-berlin.de wrote:
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.
This doesn't actually call the C++ constructors/destructors in the way they would be in normally be if the plugin had been statically linked.
This simply labels a C function to be called at dlopen time. It may be used to do some initialisation, but you would have to manually call each constructor, ... too error prone, Franks advice to create everything dynamically is sound.
Cheers Lex
Best regards. |
Geany-devel mailing list Geany-devel@uvena.de https://lists.uvena.de/cgi-bin/mailman/listinfo/geany-devel