Boost logo

Boost Users :

Subject: Re: [Boost-users] [signals2][review] The review of the signals2 library (formerly thread_safe_signals) begins today, Nov 1st
From: Frank Mori Hess (fmhess_at_[hidden])
Date: 2009-10-21 22:33:31


On Wednesday 21 October 2009, Nat Goodspeed wrote:
> Igor R wrote:
> > I guess he meant something like this:
> >
> > // windows-specific:
> > boost::shared_ptr<HINSTANCE__> ptr(LoadLibrary("mylib.dll"),
> > &FreeLibrary); // now you can bind "ptr" to the slots or anything that
> > needs maylib.dll to be alive.
>
> Oh -- so instead of using that shared_ptr for my real function, you're
> saying I could bind it as an ignored argument to a no-op function.
>
> That's true, and I thank you both for the suggested workaround. I remain
> hopeful that Frank might introduce a better solution before long. :-)

It seems to me reference-counting usage of the dll and unloading it only
when the reference count reaches zero is a good solution. It's the same
idea as using shared_ptr to destroy dynamically allocated objects rather
than passing out plain old pointers and manually calling delete.




Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net