Return-Path: Delivered-To: apmail-activemq-dev-archive@www.apache.org Received: (qmail 63808 invoked from network); 26 Apr 2007 11:35:06 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 26 Apr 2007 11:35:06 -0000 Received: (qmail 95892 invoked by uid 500); 26 Apr 2007 11:35:13 -0000 Delivered-To: apmail-activemq-dev-archive@activemq.apache.org Received: (qmail 95864 invoked by uid 500); 26 Apr 2007 11:35:13 -0000 Mailing-List: contact dev-help@activemq.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@activemq.apache.org Delivered-To: mailing list dev@activemq.apache.org Received: (qmail 95855 invoked by uid 99); 26 Apr 2007 11:35:13 -0000 Received: from herse.apache.org (HELO herse.apache.org) (140.211.11.133) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 26 Apr 2007 04:35:13 -0700 X-ASF-Spam-Status: No, hits=0.0 required=10.0 tests=UNPARSEABLE_RELAY X-Spam-Check-By: apache.org Received-SPF: pass (herse.apache.org: local policy) Received: from [199.105.164.5] (HELO smtpmail2.sensis.com) (199.105.164.5) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 26 Apr 2007 04:35:05 -0700 Received: from dimstar3.ats.sensis.com ([172.21.1.34]) by smtpmail2.sensis.com with esmtp (Exim 4.50) id 1Hh2FI-0007Fr-FR for dev@activemq.apache.org; Thu, 26 Apr 2007 07:34:44 -0400 Received: from corpatsmail1.ats.sensis.com ([172.21.1.88] helo=corpatsmail1.corp.sensis.com) by dimstar3.ats.sensis.com with esmtp (Exim 4.50) id 1Hh2FA-0001dj-Nx for dev@activemq.apache.org; Thu, 26 Apr 2007 07:34:36 -0400 Received: from 172.21.6.29 ([172.21.6.29]) by corpatsmail1.corp.sensis.com ([172.21.1.88]) with Microsoft Exchange Server HTTP-DAV ; Thu, 26 Apr 2007 11:34:36 +0000 Received: from tbish-laptop.ats.sensis.com by corpatsmail1.corp.sensis.com; 26 Apr 2007 07:34:39 -0400 Subject: Re: static and global objects From: Timothy Bish Reply-To: tim.bish@sensis.com To: dev@activemq.apache.org In-Reply-To: <10196191.post@talk.nabble.com> References: <10196191.post@talk.nabble.com> Content-Type: text/plain Content-Transfer-Encoding: 7bit Organization: Sensis Date: Thu, 26 Apr 2007 07:34:39 -0400 Message-Id: <1177587279.5453.5.camel@tbish-laptop.ats.sensis.com> Mime-Version: 1.0 X-Mailer: Evolution 2.8.3 (2.8.3-2.fc6) X-Sensis-MailScanner-Information: Scanned at Sensis Corporation by MailScanner X-Sensis-MailScanner: Found to be clean X-Sensis-MailScanner-SpamCheck: not spam (whitelisted), SpamAssassin (not cached, score=-2.871, required 5, autolearn=not spam, AWL -0.27, BAYES_00 -2.60, UNPARSEABLE_RELAY 0.00) X-Sensis-MailScanner-From: tim.bish@sensis.com X-Virus-Checked: Checked by ClamAV on apache.org This appears to be an issue soley with the MinGW tools. As such I'd recommend raising an issue with them and having them fix the problem. The code is valid C++ code that should work on a standards compliant compiler / linker. To my knowledge there are no global variables in ActiveMQ-CPP if there are they should be removed, there are however class static elements with should and actually must be initialized by the time the constructor of the class is called. I can't see any reason to write bad code to make a bad compiler / linker work. I'd recommend you use the freely available Visual Studio express, and if you need to distribute the Microsoft libraries with an app then they provide a MSVC redistributable that you can use. On Thu, 2007-04-26 at 01:22 -0700, Motl wrote: > Hi, > > Eventually, I have discovered the reason why application using activemq-cpp > builds but crashes under MinGW. > Constructors for library static objects aren't called before main() - it's > mingw compiler/liinker problem. > > Is it possible to cut out all the static and global objects from the library > and place this code into some activemq_init() function? > > I ve found 12 static objects that are of activemq type (i.e. not static > std::string): > > ./activemq/network/TcpSocket.h: static StaticSocketInitializer > staticSocketInitializer; > ./activemq/network/ServerSocket.h: static > StaticServerSocketInitializer staticSocketInitializer; > ./activemq/transport/IOTransportFactory.h: static > TransportFactoryMapRegistrar registrar; > ./activemq/support/LibraryInit.h: static activemq::support::InitDirector > initDirector; > ./activemq/util/Queue.h: static T safe; > ./activemq/logger/LogWriter.h: static concurrent::Mutex mutex; > ./activemq/logger/LoggerDefines.h: static activemq::logger::SimpleLogger > loggerName; > ./activemq/logger/LogManager.h: static concurrent::Mutex mutex; > ./activemq/concurrent/ThreadPool.h: static ThreadPool instance; > ./activemq/connector/stomp/commands/CommandConstants.h: static > StaticInitializer staticInits; > ./activemq/connector/openwire/marshal/BaseDataStreamMarshaller.h: > static utils::HexTable hexTable; > ./activemq/core/ActiveMQConstants.h: static StaticInitializer > staticInits; > > > Having done this, we could start supporting MinGW. > > > > > > > > > > > > >