activemq-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bpmuser <brian.mckin...@nrc.ca>
Subject ActiveMq-Cpp std::vector and dll problem
Date Thu, 22 Oct 2009 13:39:52 GMT

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.

Brian!
-- 
View this message in context: http://www.nabble.com/ActiveMq-Cpp-std%3A%3Avector-and-dll-problem-tp26010092p26010092.html
Sent from the ActiveMQ - Dev mailing list archive at Nabble.com.


Mime
View raw message