[zeromq-dev] zproject api design and binding question

Arnaud Loonstra arnaud at sphaero.org
Thu May 2 16:20:06 CEST 2019


Hey all,

I'm using zproject to design and build a library to extend zactor a bit. 
However I'm now running into a design issue when using callbacks.

For example I have in my api:
https://github.com/sphaero/libsphactor/blob/master/api/sphactor.api

     <callback_type name = "handler_fn">
         Callback function for socket activity
         <argument name = "msg" type = "zmsg" />
         <argument name = "arg" type = "anything" />
         <return type = "zmsg" />
     </callback_type>

So a callback which accepts a zmsg and returns a zmsg.

Works perfectly in C. However when I bind to Python it doesn't work. It 
seems Python(ctypes) only handles returning simple types from callbacks:

https://bugs.python.org/issue5710

I can see this doesn't apply to any api's I've found so for in czmq or 
zyre.

My question is whether it is bad api design from my side? Or are there 
any workarounds or better approaches for this?

Rg,

Arnaud



More information about the zeromq-dev mailing list