|
Boost : |
Subject: Re: [boost] Checking interest in DynamicLoad/DLL/DSO/Plugin library
From: Antony Polukhin (antoshkka_at_[hidden])
Date: 2014-09-02 03:14:29
2014-08-31 19:18 GMT+04:00 <jwaterloo_at_[hidden]>:
> On 2014-08-15 07:36, Antony Polukhin wrote:
>
> There is a basic implementation of a header only Plugin library:
>> https://github.com/apolukhin/Boost.Plugin
>>
>> Documentation with examples could be found here:
>> http://apolukhin.github.io/Boost.Plugin/index.html
>>
>> Is there an interest in such library in Boost community?
>> What features are missing in the library?
>>
>> Looking forward to hearing from you. Any feedback is more than welcomed.
>>
>
> Yes, tons of interest.
>
> Looking at the documentation, 2 features seem lacking; correct me if I am
> wrong.
>
> 1) Notification of shared library unloading and loading.
> If users and library/framework stick to the reference counting, which is
> recommended, how can a framework get an opportunity to do things when the
> end users/references finally disappear. While loading I may want to read a
> manifest, add services to a services registry. While unloading I may delete
> a dated version of the shared library as a more recent dated version of the
> same library has already been loaded. ... For web development or any
> development I would like to hot swap to speed development by shortening the
> redeploy test cycle like found in Java JSPs, Java JRebel or any dynamic
> language. To build limited interface based variations of this, notification
> seems essential.
>
Well, in DLL/DSO you can track loads unloads using some global variables:
struct do_at_load {
do_at_load() { std::cout << "Loading\n"; }
~do_at_load() { std::cout << "Unloading\n"; }
};
do_at_load instance;
I'll update the examples to reflect this.
> 2) How do we make our plugins object methods return references to other
> shared pointers which is also tied to the shared library counter? A better
> nested object example is in order.
>
This is up to the plugin developer. However a few functions could make a
developer's life easier.
I was thinking of adding a function `shared_ptr<shared_library>
this_library();` which would return an instance of a shared library in
which `this_library()` function was called.
Thanks to Niall, now I have some code that does things close to
`this_library()`.
-- Best regards, Antony Polukhin
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk