activemq-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Timothy Bish <tabish...@gmail.com>
Subject Re: ActiveMq-Cpp std::vector and dll problem
Date Thu, 22 Oct 2009 18:23:57 GMT
On Thu, 2009-10-22 at 06:39 -0700, bpmuser wrote:
> I've been working with the ActiveMq-Cpp interface through a dll in windows
> and I think I've fallen into stl-dll hell.
> 
> I was attempting to use:
> 
> MapMessage.h : virtual std::vector< std::string > getMapNames() const throw(
> CMSException ) = 0;
> or
> Message.h: virtual std::vector<std::string> getPropertyNames() const throw(
> CMSException ) = 0;
> 
> I started getting crashes whenever the returned vector fell out of scope.  I
> think this is related to stl and dll's not playing nicely with memory
> management.  If this is the cause of the problem then I see two possible
> solutions (unless there is a more friendly way to access the map already).
> 
> 1) Rework the functions
> 
> MapMessage.h : virtual void getMapNames(std::vector< std::string >&) const
> throw( CMSException ) = 0;
> or
> Message.h: virtual getPropertyNames(std::vector< std::string >&) const
> throw( CMSException ) = 0;
> 
> But I've never tested this so I'm not sure if it work properly, or if you
> still have the same problem.
> 
> 2) Add accessory functions
> 
> MapMessage.h : virtual size_t getMapNameCount() const throw( CMSException )
> = 0;
> and
> MapMessage.h : virtual std::string getMapName(size_t) const throw(
> CMSException ) = 0;
> or
> MapMessage.h : virtual void getMapName(size_t, std::string &) const throw(
> CMSException ) = 0;
> 
> I've never taken on this problem before so I have no clue what would work. 
> Any insight would be really appreciated.
> 

Have you ensured that the application is linked against the same version
the runtime library as the DLL?  ActiveMQ-CPP requires your application
to use the Multithreaded DLL Runtime Library, Debug or Release depending
on which AMQCPP dll you are using.

Regards
Tim.


-- 
Tim Bish
http://fusesource.com
http://timbish.blogspot.com/




Mime
View raw message