Subject: Re: [boost] Any interest in static plugins?
From: OvermindDL1 (overminddl1_at_[hidden])
Date: 2009-11-30 07:41:38
On Mon, Nov 30, 2009 at 5:25 AM, Pierre Morcello
> Dave van Soest wrote :
>>>>>I just tested this functionality in a dynamically loaded library and that works now too.
> Does it work correctly with static member of templated classes for example? I have always had problem of conflicts for those. I mean conflicts like a creation of static members copy instead of a reuse of a shared static instance (when one dll use another one dll) ... -Please note that I am no dll expert -.
For note, let me give my use case.
I have one class, say ConsoleCommands, and it is a singleton designed
in such a way that it is constructed upon the first call to
GetInstance (and it does not even attempt to construct it, just
returns its pointer if you call GetInstancePtr).
I have things called ConsoleCommand that, as an example, can be called
ConsoleCommand cmd_help("help", &cmd_helpHandler, "Displays the help menu");
Internally it basically calls
"Displays the help menu");
That will construct a ConsoleCommands if necessary (which is nothing
but an unordered_map essentially, nothing I need to worry about being
run before main).
It is not necessarily pretty, but I have been using it for near ten
years and never had a problem with it yet. I occasionally do other
things that make such registrations as well, so if he made a more
useful interface for it all so I do not need to make 3 helper structs
(only one of which actually holds data, the others are empty), then I
would be for it, but only if it really is easier. And yes, my method
works across DLL boundaries (since my code is designed to allow the
hot-plugging and removing of commands for the console for example).