orivej / pzmq

ZeroMQ 4.0+ Common Lisp bindings.

Home Page:http://orivej.github.io/pzmq/doc/index.html

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

WITH-MESSAGE does not allow me to initialize a message with size or data

phoe opened this issue · comments

The macro WITH-MESSAGE does not allow me to create a message from a predefined buffer or with a predefined size. Effectively, it only allows me to create empty messages.

From http://api.zeromq.org/4-2:zmq-msg-init-data:

The functions zmq_msg_init(), zmq_msg_init_data() and zmq_msg_init_size() are mutually exclusive. Never initialise the same zmq_msg_t twice.

Currently each binding inside WITH-MESSAGE and WITH-MESSAGES must be a symbol naming the message. A possible change would be a possibility to have lists as bindings, of form (name &key size data) that allow the user to specify the expected message size or the data from which ZMQ should construct the message. An additional key for data would be free-p which specifies whether the buffer should be freed after use; this might be convenient if the buffer does not need to be freed afterwards, for instance, when it is a pointer to a Lisp object accessed via cffi:with-pointer-to-vector-data. The latter option is impossible since ZMQ automatically disposes of buffers after sending messages.