[zeromq-dev] my first experience in mixing zmq1 and zmq2 in one app
robin at scout-trading.com
Wed Dec 23 15:59:44 CET 2009
I'll definitely be using this, thanks!
Is there any reason not to do this as part of the standard the ZMQ2 distribution? The zmq1 and zmq2 api's aren't backwards compatible in any way, seems like it should be a separate library.
From: zeromq-dev-bounces at lists.zeromq.org [mailto:zeromq-dev-bounces at lists.zeromq.org] On Behalf Of Pavel Gushcha
Sent: Wednesday, December 23, 2009 6:38 AM
To: zeromq-dev at lists.zeromq.org
Subject: [zeromq-dev] my first experience in mixing zmq1 and zmq2 in one app
I am developing system, that contains many programs, that are connected by яmq. Development was started in zmq1 and is too difficult stop development and port all programs to clean zmq2. So i decided do it step by step. Now i don't want (and don't tested yet) send messages to/from zmq1 exchanges/queues to zmq2 sockets. if my old app1 uses separate code talk with app2, i want to port these parts of app1 and app2 from zmq1 to zmq2. In this scenario i must mix zmq1 and zmq2 code in one application. For doing this, some zmq modifications are needed:
first we must rename namespace zmq to zmq2 in zmq2 sources. Without this, all compiles successfully, but overlapping of functions in so files producess strange errors and segmentation faults.
For renaming i executed following code in directory with zmq2 sources before make:
find . -name "*.h" | xargs -I % sh modify.sh %
find . -name "*.c" | xargs -I % sh modify.sh %
find . -name "*.hpp" | xargs -I % sh modify.sh %
find . -name "*.cpp" | xargs -I % sh modify.sh %
where modify.sh is:
sed 's/zmq::/zmq2::/g;s/namespace zmq/namespace zmq2/g' $1 >$1.tmp && mv $1.tmp $1
now we can run make & make install
Additionally we need to rename:
1) compiled so to something like libzmq2.so instead libzmq.
2) bindings zmq.h to zmq2.h, zmq.hpp to zmq2.hpp. And in zmq2.hpp we need change #include "zmq.h" to #include "zmq2.h"
i attached dirty gentoo ebuild for zmq1 and zmq2.
May be this info will be helpful for somebody.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the zeromq-dev