Bob Friesenhahn wrote: > On Sun, 11 Nov 2007, Daniel Herring wrote: >> >> If the vtable is functioning for normal virtual functions, why >> wouldn't it also work for a virtual destructor? Destructors are not >> magic; they are merely functions that get called just before memory is >> released. RTTI, a common culprit in dlopen issues, doesn't get >> involved here. > > Right. A more important question to ask is if static > constructors/destructors get properly executed, including the framework > necessary to support C++ exceptions. The C++ exception issue is > significant since usually the framework is set up by the original > program and if the plugin does not properly mesh into it then there is a > problem. There may also be a problem if the program is written and > linked as a C program but the plugin is C++. >
These are annoying issues that I am trying to deal with by avoidance :-) * The program and plugins are both C++ source linked using the C++ compiler. * I have avoided static constructors/destructors in the plugins. If i need to use them which I haven't yet, i will use a singleton pattern using a static pointer and creation of the singleton in the plugins initialization routine. * As for exceptions, I have defined all the methods for the plugins interface as throw() so exceptions may occur inside the plguin but may not propagate from the plugin to the application. I honestly dont know if exceptions occurring only within the plugin may cause any problems? May i ask what you mean by "properly mesh"? I was un-aware that C++ plugins which might use exceptions need to do anything in order to make exceptions work (at least internally). It is something I have not thought about. Thanks, Brendon. _______________________________________________ http://lists.gnu.org/mailman/listinfo/libtool
