[zeromq-dev] Making language bindings work with both maint andmaster

Mikko Koppanen mikko.koppanen at gmail.com
Sat Oct 2 22:34:57 CEST 2010

On Sat, Oct 2, 2010 at 9:01 PM, Martin Sustrik <sustrik at 250bpm.com> wrote:
> On 10/02/2010 09:59 PM, gonzalo diethelm wrote:
>> My suggestion was to have #define macros to identify the version of 0MQ
>> against which a binding is being compiled. Something like ZMQ_MAJOR,
>> ZMQ_MINOR, etc. Or a single #define ZMQ_VERSION to 20101002 (YYYYMMDD).
> Yeah, something like that. Let's see what other binding maintainer say
> about the topic.


Things such as ZMQ_TYPE are easy to ifdef out based on the constant
but breaks in functionality or API are possibly harder without
'pre-processor-checkable' version number.

Let's say I wanted certain functionality to be present if libzmq
version is 2.1.1 or higher.

With version id it would be the following (major,three digits for
minor,three digits for patch)

#if ZMQ_VERSION_ID >= 2001001

Where as with ZMQ_MAJOR/MINOR/PATCH it would be:

#if ZMQ_MAJOR > 2 || (ZMQ_MAJOR == 2 && ZMQ_MINOR >= 1 && ZMQ_PATCH >= 1)

I guess this is a matter of taste but I prefer the former one (there
is no harm in defining both).

What would be the benefit of using YYYYMMDD instead of the actual
version number?

Mikko Koppanen

More information about the zeromq-dev mailing list