Boost logo

Boost :

From: Robert Dailey (rcdailey_at_[hidden])
Date: 2008-07-08 20:15:39


On Tue, Jul 8, 2008 at 6:46 PM, Jeremy Pack <rostovpack_at_[hidden]> wrote:
> Robert,
>
> On Tue, Jul 8, 2008 at 4:12 PM, Robert Dailey <rcdailey_at_[hidden]> wrote:
>
>> <snip>
>>
>
>> Yes, your explanation helps out tremendously. However, I noticed that
>> load_single_library() simply deletes (by allowing it to fall out of
>> scope) the shared_library object it creates as the function returns.
>> Does this mean that it does not close the library when it is
>> destroyed? So I will need to be responsible for calling
>> shared_library::close() to release the DLL when I am done using it?
>
>
> The load_single_library function is a convenience function designed for the
> simple case in which you don't need to close the shared library until
> program termination. For more complex usage, just use a shared_library
> object.
>
>
>> I noticed also (you mentioned this) that there's an auto_close
>> construction parameter in shared_library, however this value does not
>> seem to get used anywhere. In fact, shared_library does not have a
>> destructor that I can see. Does automatic unloading of shared
>> libraries not work on destruction of shared_library objects even when
>> setting auto_close to true?
>
>
> You're right - I must have accidentally removed the destructor when I last
> refactored. Thanks! I'll fix it.
>
>
>> I'm assuming that by closing a shared_library, any factory objects
>> created from that shared_library will not function anymore, since it
>> won't have access to the classes it is creating.
>>
>
> Yep. Your program will crash or do something worse.
>
> Thanks again for your continued help!
>>
>> PS: Do you have an online version of the trunk's documentation for
>> Boost.Extension? I haven't been able to find this. Thank you.
>
>
>
> Docs are available at:
> http://redshoelace.dlinkddns.com:9080/boost/doc/extension/index.html

Thank you, this cleared up all of my confusion.

What I'm doing now is keeping a single factory_map object as a member
of my class, and each time the user wants to "concatenate" factories,
I simply call load_single_library() and pass in my existing
factory_map member. Things seem to be working well so far.

I appreciate your help! Great library!


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