
On Fri, Dec 4, 2009 at 10:37 AM, Dave van Soest <dsoest@xs4all.nl> wrote:
On 12/04/2009 03:11 AM, OvermindDL1 wrote:
Jeremy, your code example also has many similarities with the code in my library. So, now I'm interested why you aren't using this approach... What kind of troubles do you have with it?
1. Boost.Extension is targeted at shared libraries linked at run time, using functions like dlopen(). This means that in order to use the type of static initialization that you do, I'd have to merge the Factory Managers from multiple shared libraries when the libraries are loaded, and unmerge them when the shared libraries are unloaded. I'd have to track how many objects had been created from each shared library to decide whether or not a given shared library could be unloaded. 2. I would have to introduce a dependency on Boost.Thread to guarantee thread-safety when these libraries are opened. 3. The library is currently header-only. This would be lost. 4. I wanted to allow users the flexibility of either using it in a static fashion or not. I could certainly provide wrapper functions that would enable this type of static initialization. For your goal, these issues aren't really a problem. Jeremy