Boostlog and ASIO crash in shared library
Hi,
My project use a simple main using dlopen to "run" the real main function
in target shared library. I use both Boost Log and ASIO (for threadpool) in
the project. In Linux I found the ASIO got weird behavior with some
un-initialized variables and crashing all the time. I am able to trim down
my problem into a small program as below:
// *** threadpool.cpp ***
#include <iostream>
#include <memory>
#include
On 2014-09-16, 3:08 AM, Ray Cheng wrote:
My project use a simple main using dlopen to "run" the real main function in target shared library. I use both Boost Log and ASIO (for threadpool) in the project. In Linux I found the ASIO got weird behavior with some un-initialized variables and crashing all the time. I am able to trim down my problem into a small program as below:
There might be some interaction with BOOST_LOG_USE_COMPILER_TLS from the sounds of it. Try disabling/enabling that and see if that narrows it down further. It does look like you're doing the right thing, but ensure that your shared object will invoke global C++ constructors. I remember some *nix somewhere at some time that didn't do this. Sohail
On Wed, Sep 17, 2014 at 10:48 AM, Sohail Somani
There might be some interaction with BOOST_LOG_USE_COMPILER_TLS from the sounds of it. Try disabling/enabling that and see if that narrows it down further.
It does look like you're doing the right thing, but ensure that your shared object will invoke global C++ constructors. I remember some *nix somewhere at some time that didn't do this.
I did try explicitly undef BOOST_LOG_USE_COMPILER_TLS in boost/config/user.hpp, but it didn't help. I did a global search BOOST_LOG_USE_COMPILER_TLS is by default disable, no where define it in boost code. What is the "global C++ constructors"? may be i missed something when using boost_log?
participants (2)
-
Ray Cheng
-
Sohail Somani