[zeromq-dev] Fix for libzmq.vcproj failing to compile. And a question about size of message changing after being sent by socket

Salvor Hardin salvor.public at gmail.com
Tue Jun 29 06:26:13 CEST 2010

I'm using latest zeromq from git (zeromq2-ba91644...) compiled with
Visual C++ 2008 SP1, tested on Vista 32-bit.

Please consider adding NOMINMAX to preprocessor definitions in
libzmq.vcproj.  Without NOMINMAX, msvc fails to compile msg_store.cpp
because Windef.h defines "min".

Also, here's a C++ code snippet showing odd behavior (message size
goes from 22 before sending, to 0 after sending.)
Please let me know if this is a bug or a feature. Thanks.

zmq::context_t ctx (1);
zmq::socket_t s (ctx, ZMQ_REQ);
s.connect ("tcp://localhost:5555");

const char *query_string = "SELECT * FROM mytable";
zmq::message_t query (strlen (query_string) + 1);
memcpy (query.data (), query_string, strlen (query_string) + 1);

printf("query.size() before send: %ld\n", query.size());  // 22
s.send (query);
printf("query.size() after send: %ld\n", query.size());   // 0

More information about the zeromq-dev mailing list