This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Static initialisation (fwd)


Could someone take a moment to give me an answer on this problem please?

Thanks,

/Mike

Forwarded message:
> From gcc-bugs-return-45552-mharrold=cas.org@gcc.gnu.org Sun Nov 10 23:11:04 2002
> Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm
> Precedence: bulk
> List-Unsubscribe: <mailto:gcc-bugs-unsubscribe-mharrold=cas.org@gcc.gnu.org>
> List-Archive: <http://gcc.gnu.org/ml/gcc-bugs/>
> List-Post: <mailto:gcc-bugs@gcc.gnu.org>
> List-Help: <mailto:gcc-bugs-help@gcc.gnu.org>
> Sender: gcc-bugs-owner@gcc.gnu.org
> Delivered-To: mailing list gcc-bugs@gcc.gnu.org
> From: Mike Harrold <mharrold@cas.org>
> Message-Id: <200211110410.gAB4Aqq17294@srv06.cas.org>
> Subject: Static initialisation
> To: gcc-bugs@gcc.gnu.org
> Date: Sun, 10 Nov 2002 23:10:52 -0500 (EST)
> MIME-Version: 1.0
> Content-Type: text/plain; charset=us-ascii
> Content-Transfer-Encoding: 7bit
> Content-Length: 985
> 
> Hi,
> 
> Before I submit a bug report, I wanted to know if the following
> behaviour is correct.
> 
> In a source module that contains static members of a class, the
> initialisation and destruction of those members is done within
> the static_initialization_and destruction function.
> 
> However, one of the (static) member functions of the class defines
> a static const variable of a class type derived from std::string.
> The initialisation of this variable registers the destruction
> mechanism with atexit in order to destroy it.
> 
> Is this the correct behaviour?
> 
> The reason I ask is because this particular module is dynamically
> loaded and unloaded using dlopen/dlclose. Naturally, when the
> program terminates, the exit mechanism ends up calling the
> destruction mechanism of the variable, but the code has already
> been unloaded so I get a seg-fault.
> 
> Please let me know either way. If the behaviour is incorrect, I
> will create a small test-case and submit a full bug report.
> 
> Thanks in advance,
> 
> /Mike
> 


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]