Something like this:
type
TPollItem* = object
socket*: PSocket
fd*: cint
events*: cshort
revents*: cshort
poller*: pointer
proc poll*(items: ptr UncheckedArray[TPollItem], nitems: cint, timeout:
clong): cint{.
cdecl, importc: "zmq_poll", dynlib: zmqdll.}
template asUncheckedArray(a): untyped = cast[ptr
UncheckedArray[typeof(a[0])]](addr a[0])
var a: array[2, TPollItem]
a[0] = TPollItem(socket: d1.s, events: ZMQ_POLLIN)
a[1] = TPollItem(socket: d2.s, events: ZMQ_POLLIN)
# Poll on 2 element starting at adress p1
var res : int = poll(asUncheckedArray(a), 2, 10000)
echo res
if res >= 0 :
var res1 = bitand(p1.revents, ZMQ_POLLIN.cshort)
var res2 = bitand(p2.revents, ZMQ_POLLIN.cshort)
echo "res1:", res1, " && res2:", res2
Run