Hi,
Thanks for the UncheckedArray trick to access underlying C-array.
asUncheckedArray will return a type :
ptr UncheckedArray[TPollItem]
Run
I tried both :
var res : int = poll(asUncheckedArray(p)[0].addr, 2, 10000)
var res : int = poll(cast[ptr TPollItem](asUncheckedArray(p)), 2, 10000)
Run
to get a ptr TPollItem back. Both gives me same result as the code I posted.
I also tried to define a poll function with UncheckedArray ptr parameters :
proc poll*(items: ptr UncheckedArray[TPollItem], nitems: cint, timeout:
clong): cint{.
cdecl, importc: "zmq_poll", dynlib: zmqdll.}
var res : int = poll(asUncheckedArray(p), 2, -1)
Run
In all those case, I only the first TPollItem is receiving data. If I try to
receive manually data on the second connexion with no POLLIN flag set (since I
know data is present in a trivial) I can receive the data normally.