[zeromq-dev] Checking for Win platform?

Martin Sustrik sustrik at imatix.com
Mon Nov 2 23:52:53 CET 2009


Hi James,

>It is a pretty common standard in visual studio to include "WIN32" as a
>preprocessor definition. This could work for your header chagne.
>
>#ifdef WIN32
>typedef void* fd_t
>#else
>typedef int fd_t
>#endif

That's one option. It would require anyone compiling an application to
define WIN32 (even under MinGW or so).

The other option would be to include zmq_platform.h from zmq.h,
zmq_platform.h having a single line:

#define ZMQ_HAVE_WIN32

zmq_platform would be shipped in Win32 package. On other platforms
autotools can automatically generate zmq_platform.h. Say:

#define ZMQ_HAVE_LINUX

Similar thing to the Win32 trick would have to be done on OpenVMS
platform, where autotools are not available.

Not sure which option is better though...

Martin



More information about the zeromq-dev mailing list