Boost logo

Boost Users :

Subject: Re: [Boost-users] [Boost::any] Memory management using dynamic libraries
From: Eugenio Bargiacchi (svalorzen_at_[hidden])
Date: 2013-12-26 13:27:46


I've tried to instantiate a simple integer, but the problem persists
(not sure if it even matters though). Though if a value is created
from the framework, I have no problems deleting it no matter the
modules' status, so something of that sort must be going on.

As for unloading shared libraries, I don't really think I will need it
at runtime, though the program will need to close at one point, and I
just want the whole thing to be as clean as possible without just
sweeping the problem away because it only happens during shutdown.

However, if my problem can be solved by simply destroying the map
before unloading all shared libraries, I am content. What I am most
concerned about is whether every single time a module destroys a value
it needs to somehow give control back to the module that created it so
that it can destroy it, or if that is handled automatically when a
destructor is called.

On 12/26/13, Nevin Liber <nevin_at_[hidden]> wrote:
> On 25 December 2013 09:26, Eugenio Bargiacchi <svalorzen_at_[hidden]> wrote:
>
>> I'm building a framework which needs to allow communication between
>> shared libraries which are loaded at runtime.
>>
>> The problem that I had, for example, resulted in a segfault if I tried
>> to unload the modules from memory before the destruction of the map
>> (which is owned by the framework), during boost::any destruction.
>
>
> Unloading shared libraries in C++ is fraught with peril.
>
> Could the problem be that you've unloaded the code for the destructor of
> the object stored in the boost::any object?
> --
> Nevin ":-)" Liber <mailto:nevin_at_[hidden]> (847) 691-1404
>


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net