Support newer libzmq.

master
Robert G. Jakabosky 2 years ago
parent b9d5000b9d
commit fba94951bc
No known key found for this signature in database
GPG Key ID: 0C38AF433FE0B1C0

@ -774,6 +774,9 @@ local tmp_val_len = ffi.new('size_t[1]', 4)
-- create helper function for `zmq_send`
c_source[[
LUA_NOBJ_API ZMQ_Error simple_zmq_send(ZMQ_Socket *sock, const char *data, size_t data_len, int flags) {
#if VERSION_3_2
return zmq_send(sock, data, data_len, flags);
#else
ZMQ_Error err;
zmq_msg_t msg;
/* initialize message */
@ -787,6 +790,7 @@ LUA_NOBJ_API ZMQ_Error simple_zmq_send(ZMQ_Socket *sock, const char *data, size_
zmq_msg_close(&msg);
}
return err;
#endif
}
]],
method "send" {
@ -859,6 +863,14 @@ typedef struct ZMQ_recv_event {
const char *err;
} ZMQ_recv_event;
#if (ZMQ_VERSION_MAJOR == 4) && (ZMQ_VERSION_MINOR >= 1)
typedef struct zmq_event_t {
int16_t event;
int32_t value;
} zmq_event_t;
#endif
int monitor_recv_event(ZMQ_Socket *s, zmq_msg_t *msg, int flags, ZMQ_recv_event *ev)
{
int rc ;

@ -19,8 +19,10 @@
-- THE SOFTWARE.
object "ZMQ_StopWatch" {
include "zmq_utils.h",
c_source[[
#if (ZMQ_VERSION_MAJOR <= 4) && (ZMQ_VERSION_MINOR <= 1)
#include "zmq_utils.h"
#endif
typedef struct ZMQ_StopWatch ZMQ_StopWatch;
]],
constructor "start" {

@ -318,9 +318,8 @@ c_function "proxy" { if_defs = "VERSION_3_2",
},
--
-- zmq_utils.h
-- utils
--
include "zmq_utils.h",
c_function "stopwatch_start" {
c_call "!ZMQ_StopWatch *" "zmq_stopwatch_start" {},
},

Loading…
Cancel
Save