pmutka's picture

How can I relay information between a plugin and an instance creating a HTTPServer that loads the plugin? Although this is fairly simple with statically linked resource handlers, dynamical plugins are more challenging. I would like to be able to pass references to objects to the shared object.
Regards,
Petri

Mike Dickey's picture
The abstraction of plugins

The abstraction of plugins makes it difficult to share data that isn't part of the base class design.  If that's what you need to do, then you might want to use HTTPServer & statically-linked resource callbacks instead of the WebServer class & plugins.

Submitted by Mike Dickey on Tue, 02/16/2010 - 17:36.
pmutka's picture
Thank you for your input!

Thank you for your input! That is pretty much what I suspected. Since I do not wish to modify the base classes I had to figure out a temporary solution.
My "quick and dirty" rigging employs interprocess communications, i.e. I created a kernel message queue and used it to pass a structure containing an object pointer to the plugin from the instance creating the HTTPServer. Since they operate within the same thread sharing resources, it seems to be working fine. However, the main program and the plugin should agree upon the queue identification in advance, which goes against the idea of the plugin abstraction. Additionally, such solution is applicable only in the Unix/Linux platforms.
Regards,
Petri

Submitted by pmutka on Tue, 02/16/2010 - 23:24.