activemq-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Timothy Bish <>
Subject Re: static and global objects
Date Thu, 26 Apr 2007 11:34:39 GMT
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

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.

View raw message