[zeromq-dev] Portability of 0MQ API
Pieter Hintjens
ph at imatix.com
Sat Aug 7 19:55:31 CEST 2010
Hi,
Going through the API, I see the zmq_errno(3) man page, which says,
more or less, "only use this function under Windows".
>From the point of view of 0MQ, I see the point, namely to get an API
that comes as close as possible to the POSIX socket API.
However, from the point of view of the user, it seems counter
productive to push this to the application layer.
For other resources, we can adopt the principle, "0MQ is not a
portability layer", so people can use whatever library they want to
for portability.
But for 0MQ resources, this is not an option. Thus, applications will
have to either:
* use zmq_errno everywhere, going against the advice of the manual
* write non-portable code
* use #ifdefs in every single case where they want to access errno
* write their own portability wrapper that accesses either errno or
zmq_errno depending on the OS
None of these choices seem ideal.
Anyone have other ideas? Two options that seem obvious but presumably
won't work are:
* promote zmq_errno(3) for use on all platforms
* write the win32 error code to errno (mapping to Unix error codes too)
We already use zmq_strerror(3) instead of strerror.
-Pieter
More information about the zeromq-dev
mailing list