Boost logo

Boost :

Subject: Re: [boost] News about proposed Boost.Application library
From: Joseph Van Riper (fleeb.fantastique_at_[hidden])
Date: 2014-07-29 06:19:06


On Tue, Jul 29, 2014 at 5:43 AM, Rob Stewart <robertstewart_at_[hidden]>
wrote:

> On July 29, 2014 3:39:16 AM EDT, "Klaim - Joël Lamotte" <mjklaim_at_[hidden]>
> wrote:
> >I disagree. In my experience it would be more useful if it contained a
> >weak_ptr to the library, with a centralised system keeping all loaded
> >libraries alive and allowing the used to unload the library
> >explicitely.
> >The get_symbol return type would then be testable.
> >That way it is easier to find issues related to plugins and its still
> >possible for the user to prevent these issues at runtime.
>
> Please explain. Using a weak_ptr means each access must be tested, with
> synchronized access, to boot, versus assurance of validity with the
> shared_ptr.
>

I think there are two scenarios. In one, you're dynamically loading the
library, and you want it to remain in memory for the duration of the
application's run (you never intend to deallocate it until the application
is finished). You might consider this scenario for situations where you're
licensing different facets of your application, and licensing determines
available features.

However, there's another scenario where you dynamically load the library,
then deallocate it as soon as you're done with it (and where it is
important to do so). For those scenarios, this centralized system of
keeping all loaded libraries alive is an unnecessary and unwanted burden.
 You might consider this scenario in cases where you have a long-running
service that you cannot lightly take down, but you want to be capable of
making updates to features the service use. At least on Windows, you
cannot replace a DLL if it is loaded, so if it's only loaded when in use,
you'd be able to swap out the library without stopping the service.

I think both scenarios can be supported by having an object that acts as
this centralized system which one may use if desired, while also having the
current system.

- Trey


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk