Dear Community,
I've got an application that loads a .so using dlopen, dlsym, etc. It
also starts up an IO service pool and manages them. The application
implements a socket server, that starts a thread for each incoming
connection. Inside each of the threads started, a .so function is called
based on information received on the socket.
Inside the function of the .so, I want to connect to a remote server
using the IO service in the main program (that called the dlopen, etc.).
It seems, however, that if I use an IO service not created inside
the .so, the handle_connect never gets called by ASIO.
Is anyone aware of this problem. I suppose I'm just doing something
stupid w.r.t. shared object usage (maybe permissions, etc.). Or is the
ASIO library not initialised inside the DLL? When I create an IO service
pool inside the .so, everything works, but obviously this is not ideal
as the pool starts threads that execute the run() method on the io
service.
Interesting thing is that I can actually pass a session object (from the
socket server accept operation) from my main program to the .so function
and have messages read and written on the socket. But when I try and
create a new connection using the session's IO service (e.g. from a
sock.get_io_service() call), then I never get the handle_connect.
I've even tried:
#pragma GCC visibility push(default)
#include