You cannot unload from the slot because (plugin signal) --- invokes ---> (slot). So the plugin is in use until the signal invocation has returned.

Therefore the slot must arrange for deferred unloading of the plugin. How can the deferred method know whether the signal invocation has completed? By using a semaphore, for example. The semaphore must be known to both the plugin and the main application, and (in case of an unnamed semaphore) its address must physically reside in the main application’s address space.

 

It’s tricky and you should rather be asking yourself: “why bother”?

 

 

From: Boost-users <boost-users-bounces@lists.boost.org> On Behalf Of Sean Farrow via Boost-users
Sent: Friday, March 29, 2019 08:33
To: 'boost-users@lists.boost.org' <boost-users@lists.boost.org>
Cc: Sean Farrow <sean.farrow@seanfarrow.co.uk>
Subject: [Boost-users] [dll] Notifying a plugins host that a plugin should be unloaded

 

Hi all,

 

I have an application that uses boost.dll to provide plugin functionality.

 

I have a base class defined that all plugins derive from. I’m looking for a way to notify the host application that a particular plugin should be unloaded. This is determined by the plugin itself.

 

Is signals/slots appropriate here or is there a better option?

 

Has anyone else done anything like this?

 

Any help appreciated.

 

Kind regards

Sean.