Pages

Hello ZeroMQ 3.1

ØMQ is currently available in two versions, 2 and 3.

On December 2011, there has been a release for both of them, 2.1.11, stable, and 3.1.0, beta. The 3.0.x development has been discontinued, for a number of reasons that you can read in the OMQ release report on github.

I am not using ZMQ for a production job at the moment, so I can do some experimentation with version 3, even if it is not marked as stable.

As usual, first thing to do is downloading the software and set the development environment up.

It didn't change much, as I have seen following my own installation notes I wrote for the 2.1.x version.

First step is going to the official download page on zeromq.org, and choose the version that suits you better.

I'm still working on Windows with MSVC 2010 so, once I downloaded the compressed package, I expanded it, and I opened the builds/msvc/msvc10.sln solution. And then was just a matter of building it to get a fresh copy of ØMQ lib and dll.

Then I created a new solution, where I ported the first very simple application that just say hello and show the current 0MQ version.

A few settings for the MSVC project:

In the VC++ Directories tab, I added the (...)\zeromq-3.1.0\include directory in the field Include Directories (as one would expected).
In the Linker - General tab, I added (...)\zeromq-3.1.0\lib\Win32 to the Additional Library Directories.
And in the Linker - Input tab, I added among the Additional dependencies the zmq library name (it varies if you are using a normal or debug version).

Remember to put the DLL in a path visible to the application at runtime.

Once all of this is done, we could write the code:
#include <iostream>
#include <zmq.h>

int main()
{
    int major, minor, patch;
    zmq_version(&major, &minor, &patch);
    std::cout << "Hello from ZMQ " << major << '.' << minor << '.' << patch << std::endl;
}
Not a very creative use of ZeroMQ, but if it compiles, and if you get this output:
Hello from ZMQ 3.1.0
You can assume everything works fine.

No comments:

Post a Comment