Sharing a boost :: asio :: io_service object between dynamically loaded libraries

First, what I did (a minimal sample would be provided if I hadn’t done anything stupid):

I have a GUI application that needs to support multiple network interfaces in order to change the content displayed in the GUI. Network interfaces are implemented as plugins that load dynamically when the GUI starts. The GUI application provides a boost :: asio :: io_service object, which is passed through a link to the interfaces, so they can use it to build asynchronous I / O. In the GUI thread, this io_service object is polled to synchronize the access of network interfaces to content.

Now the problem is that the handlers are not called by the io_service object when it is polled. To narrow this down, I implemented only one interface and created an io_service object in it, which still causes polling from the GUI thread and which works.

Now my question is: is it possible that there is a general problem with passing the io_service object to the DLL functions loaded at runtime?

If the scenario is too unclear, I will give a minimal example.

EDIT: I feel really stupid :) Just hacked into a minimal example, and that of course works like a charm. This pretty much means that the problem arises from some other piece of software.

So thank you all for their input!

To make this question at least a little useful: Anyone who wants to do something like this (plug-ins for the network synchronized via boost :: asio :: io_service), you can download a minimal example here .

+6
c ++ boost dll boost-asio
source share
1 answer

I would check out a few options:
* Perhaps the object is copied at some point, and not transmitted by reference; you can make it raise :: noncopyable to prevent this from happening.
* Check the return value of the poll, if it is greater than 0, some handler was launched; if it is 0, the problem is that thinking is absent. * Add a test handler in your graphics application to exclude this parameter associated with the DLL problem.

Happy debugging!

+2
source share

All Articles